| 16 |
|
|
| 17 |
|
short *urperm; /* urand() permutation */ |
| 18 |
|
int urmask; /* bits used in permutation */ |
| 19 |
+ |
static int urorder; /* number of bits */ |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
initurand(size) /* initialize urand() for size entries */ |
| 45 |
|
else |
| 46 |
|
urperm[i+offset]++; |
| 47 |
|
} |
| 48 |
+ |
} |
| 49 |
+ |
|
| 50 |
+ |
|
| 51 |
+ |
int |
| 52 |
+ |
urhash(d, n) /* hash a set of integer values */ |
| 53 |
+ |
register int *d; |
| 54 |
+ |
register int n; |
| 55 |
+ |
{ |
| 56 |
+ |
static int tab[8] = {13623,353,1637,5831,2314,3887,5832,8737}; |
| 57 |
+ |
register unsigned hval; |
| 58 |
+ |
|
| 59 |
+ |
hval = 0; |
| 60 |
+ |
while (n-- > 0) |
| 61 |
+ |
hval += *d++ * tab[n&7]; |
| 62 |
+ |
return(hval & urmask); |
| 63 |
|
} |