Use the correct hash for this

This commit is contained in:
NepDisk 2026-05-04 22:34:42 -04:00
parent 4c8899b373
commit 03400d0a81
3 changed files with 17 additions and 1 deletions

View file

@ -1455,7 +1455,7 @@ static UINT32 xxHashString32(const char *name)
#define NAME cvar_map_t
#define KEY_TY const char *
#define VAL_TY consvar_t *
#define HASH_FN xxHashString32
#define HASH_FN FNV1a_HashLowercaseString
#define CMPR_FN vt_cmpr_casestring
#include "verstable.h"

View file

@ -2557,6 +2557,20 @@ UINT32 FNV1a_QuickCaseHash(const char *message, size_t size)
return hash;
}
UINT32 FNV1a_HashLowercaseString(const char *message)
{
UINT32 hash = FNV1A_OFFSET_BASIS;
while (*message)
{
hash ^= tolower(*message);
hash *= FNV1A_PRIME;
message++;
}
return hash;
}
// Returns true if the string is empty.
boolean M_IsStringEmpty(const char *s)
{

View file

@ -126,6 +126,8 @@ FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
// Hashes some message using FNV-1a
UINT32 FNV1a_QuickCaseHash(const char *message, size_t size);
UINT32 FNV1a_HashLowercaseString(const char *message);
boolean M_IsStringEmpty(const char *s);
int M_RoundUp(double number);