Use the correct hash for this
This commit is contained in:
parent
4c8899b373
commit
03400d0a81
3 changed files with 17 additions and 1 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue