| 6 | #define DJB2_ITER(h, x) ((h * 33) + x) |
| 7 | |
| 8 | Word Hash(const char *addr, Int n) { |
| 9 | Word hash = DJB2_INIT; |
| 10 | while (n-- > 0) { |
| 11 | Byte byte = (Byte)(*addr++); |
| 12 | hash = DJB2_ITER(hash, byte); |
| 13 | } |
| 14 | return hash; |
| 15 | } |
| 16 | |
| 17 | Word Hash(const char *str) { |
| 18 | Word hash = DJB2_INIT; |