CompuServe Messages

#amigados bitmap

    27-Mar-88 13:58:46
Sb: #115689-#amigados bitmap
Fm: Ariel Butler 76515,1572
To: PAT O'BRIEN 76064,341
Pat: Here is the Hash function, courtesy of Neil Katin: hash(s) unsigned char *s; int i; int res; unsigned char *sp; unsigned c; res = strlen(s); for (i = 1, sp = s; *sp ; i++, sp++) { c = *sp; if ( c >= 'a' && c <= 'z' ) { c = c – 'a' + 'A'; } res = (( res * 13 + c) & 0x7FF); } return (res); } Note: The computed hash value is the longword offset into the directory block, not into the hash table. Also, don't forget to use 32 bit integers as the default.