commit 5c4effb3ba5c1a601d8de6f4b15f9bfc9d120a8d
parent 8afb6a1223ec2057765ba8d1228d131bff0c88fb
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 29 Apr 2021 09:24:19 -0400
Fix FNV-32 prime constant
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/util.c b/src/util.c
@@ -10,7 +10,7 @@
uint32_t
fnv1a(uint32_t hash, unsigned char c)
{
- return (hash ^ c) * 1099511628211;
+ return (hash ^ c) * 16777619;
}
uint32_t
diff --git a/tests/13-tagged.ha b/tests/13-tagged.ha
@@ -20,19 +20,19 @@ fn storage() void = {
tag: uint,
union { _u8: u8, _u16: u16, _u32: u32, _u64: u64 },
};
- assert(y.tag == 1228467311); // u8 type ID
+ assert(y.tag == 3181589295); // u8 type ID
assert(y._u8 == 42);
x = 1337u16;
- assert(y.tag == 1226007386); // u16 type ID
+ assert(y.tag == 3481467866); // u16 type ID
assert(y._u16 == 1337);
x = 0xCAFEBABEu32;
- assert(y.tag == 1228088861); // u32 type ID
+ assert(y.tag == 1906196061); // u32 type ID
assert(y._u32 == 0xCAFEBABE);
x = 0xCAFEBABEDEADBEEFu64;
- assert(y.tag == 1227899636); // u64 type ID
+ assert(y.tag == 1268499444); // u64 type ID
assert(y._u64 == 0xCAFEBABEDEADBEEF);
};