mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +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)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned ret = 0;
|
||||
while(*name)
|
||||
ret += *name++;
|
||||
return ret%HASHSZ;
|
||||
ret = (ret << 1) + (*name++);
|
||||
return ret % HASHSZ;
|
||||
}
|
||||
|
||||
struct declared_register *find_register(char *name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user