*Finally* fixing the EXP bug

This commit is contained in:
The Gears of Progress
2024-12-19 18:15:04 -05:00
parent b382aec0dc
commit 41f7fcb1aa
7 changed files with 51 additions and 22 deletions

View File

@@ -238,4 +238,20 @@ void set_missingno(bool val)
bool get_missingno_enabled()
{
return missingno_enabled;
}
// FNV-1a 32-bit hash function for byte arrays
u32 fnv1a_hash(unsigned char* data, size_t length)
{
const uint32_t fnv_prime = 0x01000193;
const uint32_t fnv_offset_basis = 0x811C9DC5;
uint32_t hash = fnv_offset_basis;
for (size_t i = 0; i < length; ++i)
{
hash ^= data[i];
hash *= fnv_prime;
}
return hash;
}