~sircmpwn/harec unlisted

5c4effb3ba5c1a601d8de6f4b15f9bfc9d120a8d — Drew DeVault a month ago 8afb6a1
Fix FNV-32 prime constant

Signed-off-by: Drew DeVault <sir@cmpwn.com>
2 files changed, 5 insertions(+), 5 deletions(-)

M src/util.c
M tests/13-tagged.ha
M src/util.c => src/util.c +1 -1
@@ 10,7 10,7 @@
uint32_t
fnv1a(uint32_t hash, unsigned char c)
{
	return (hash ^ c) * 1099511628211;
	return (hash ^ c) * 16777619;
}

uint32_t

M tests/13-tagged.ha => tests/13-tagged.ha +4 -4
@@ 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);
};