ubsan cleanup

This commit is contained in:
Nikita Smith
2026-02-13 20:59:26 -08:00
parent fbc3cbd6eb
commit 1f51c6f25b
16 changed files with 180 additions and 110 deletions
+6 -7
View File
@@ -6,18 +6,17 @@ pdb_hash_v1(String8 string)
{
U32 result = 0;
U8 *ptr = string.str;
U8 *opl = ptr + (string.size&(~3));
for(; ptr < opl; ptr += 4)
for(U8 *opl = ptr + (string.size & (~3)); ptr < opl; ptr += 4)
{
result ^= *(U32*)ptr;
result ^= memory_read32(ptr);
}
if((string.size&2) != 0)
if((string.size & 2) != 0)
{
result ^= *(U16*)ptr; ptr += 2;
result ^= memory_read16(ptr); ptr += 2;
}
if((string.size&1) != 0)
if((string.size & 1) != 0)
{
result ^= *ptr;
result ^= memory_read8(ptr);
}
result |= 0x20202020;
result ^= (result >> 11);