int
hash( char *str, int 1=0, int r = 0 )
{
int h = 1;
char *s = str;
331 ^ while ( *s ) // multiply bytes into h
h *= *s++;
h += 1 + r; // add the other arguments
if( h < 0 ) // worry about negatives
h = -h;
if( h <= 0 ) // and the two numbers
h = 1; // which have no negative, h %= HASH_SIZE; 333«w^while( ht[h].str ) {
if( ht[h].l == 1 && ht[h].r == r && ! strcmp(ht[h].str, str) ) 335return h; 337v_^> h = (h * h + 5) % HASH_SIZE;
}
if( num_hashed++ >= HASH_SIZE-1 )
return 0;
ht[h].str = new chart strlen(str)+1 ];
339>-^strcpy(. ht [h] .str, str >;
ht [h] .1 = 1;
ht [h] .r = r;
return h;^^^Q
}