return double_to_d22(a) % m;
}
-#define FNV1_32A_INIT (unsigned)0x811c9dc5
+#define FNV1_32A_INIT 0x811c9dc5U
+#define FNV1_32A_PRIME 16777619U
static inline unsigned fnv_32a_buf(void *buf, size_t len, unsigned hval)
{
unsigned char *be = bp + len;
while (bp < be) {
hval ^= (unsigned) *bp++;
- hval +=
- (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) +
- (hval << 24);
+ hval *= FNV1_32A_PRIME;
}
return hval;
}
unsigned char *s = (unsigned char *) str;
while (*s) {
hval ^= (unsigned) *s++;
- hval +=
- (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) +
- (hval << 24);
+ hval *= FNV1_32A_PRIME;
}
return hval;
}