34 |
|
#define NHASH 521 /* hash size (a prime!) */ |
35 |
|
#endif |
36 |
|
|
37 |
+ |
#define hash(s) (shash(s)%NHASH) |
38 |
+ |
|
39 |
|
#define newnode() (EPNODE *)ecalloc(1, sizeof(EPNODE)) |
40 |
|
|
41 |
|
extern char *ecalloc(), *emalloc(), *savestr(), *strcpy(); |
42 |
|
|
41 |
– |
static int hash(); |
42 |
– |
|
43 |
|
static double dvalue(); |
44 |
|
|
45 |
|
long eclock = -1; /* value storage timer */ |
667 |
|
ep2 = ep2->sibling; /* else reuse old value */ |
668 |
|
|
669 |
|
return(ep2->v.num); |
670 |
– |
} |
671 |
– |
|
672 |
– |
|
673 |
– |
static int |
674 |
– |
hash(s) /* hash a string */ |
675 |
– |
register char *s; |
676 |
– |
{ |
677 |
– |
register int rval = 0; |
678 |
– |
|
679 |
– |
while (*s) |
680 |
– |
rval += *s++; |
681 |
– |
|
682 |
– |
return(rval % NHASH); |
670 |
|
} |