mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
Reduce hash value collision probability in src/main.c
Original code use "hash_value = *name++", which may produce hash value collision for word permutations like "abc", "bac" and "cba".
This commit is contained in:
parent
940522588a
commit
7186723f81
@ -78,10 +78,10 @@ static void usage(void)
|
|||||||
|
|
||||||
static int hash(char *name)
|
static int hash(char *name)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
unsigned ret = 0;
|
||||||
while(*name)
|
while(*name)
|
||||||
ret += *name++;
|
ret = (ret << 1) + (*name++);
|
||||||
return ret%HASHSZ;
|
return ret % HASHSZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct declared_register *find_register(char *name)
|
struct declared_register *find_register(char *name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user