general hash functions for text: SUMMARY!

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Sat Oct 20 07:09:11 AEST 1990


In article <1990Oct19.040234.20794 at watmath.waterloo.edu> cpshelley at watmsg.waterloo.edu (cameron shelley) writes:
>   return h & ROOTLEN;           /* ROOTLEN must be a power of 2, ie. 2^16 */

Just to make sure it gets said: This should probably be h % ROOTLEN, or
h & (ROOTLEN - 1). The latter is faster under most computers and
compilers.

---Dan



More information about the Comp.lang.c mailing list