Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/tools/ctf/cvt/hash.c
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
int | int | ||||
hash_name(int nbuckets, const char *name) | hash_name(int nbuckets, const char *name) | ||||
{ | { | ||||
const char *c; | const char *c; | ||||
ulong_t g; | ulong_t g; | ||||
int h = 0; | unsigned h = 0; | ||||
for (c = name; *c; c++) { | for (c = name; *c; c++) { | ||||
h = (h << 4) + *c; | h = (h << 4) + *c; | ||||
jrtc27: This changes based on char signedness? | |||||
if ((g = (h & 0xf0000000)) != 0) { | if ((g = (h & 0xf0000000)) != 0) { | ||||
h ^= (g >> 24); | h ^= (g >> 24); | ||||
h ^= g; | h ^= g; | ||||
} | } | ||||
} | } | ||||
return (h % nbuckets); | return (h % nbuckets); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |
This changes based on char signedness?