home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume11 / jotto / part01 / subs.c < prev   
C/C++ Source or Header  |  1990-12-11  |  432b  |  35 lines

  1. /*
  2.  *    subroutines
  3.  *
  4.  *    These are worth optimizing in assembly language.
  5.  */
  6.   
  7. #include "jotto.h"
  8.  
  9. int
  10. inter(a,b)
  11. char *a, *b;
  12. {
  13.     int retval;
  14.     char *ap, *bp;
  15.  
  16.     retval = 0;
  17.     for (ap=a; ap<a+WORDLEN; ap++)
  18.     for (bp=b; bp<b+WORDLEN; bp++) if (*ap == *bp) {
  19.         retval++;
  20.         break;
  21.     }
  22.     return retval;
  23. }
  24.  
  25. int
  26. blog(n)
  27. register int n;
  28. {
  29.     register int retval;
  30.     if (!n--) return 0;
  31.     retval = 0;
  32.     while (n) {n>>=1; retval++;}
  33.     return retval;
  34. }
  35.