public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ae5dded
)
modified hash function to deliver same value on 2 byte and 4 byte machines
author
ceriel
<none@none>
Thu, 31 Jan 1991 15:17:54 +0000
(15:17 +0000)
committer
ceriel
<none@none>
Thu, 31 Jan 1991 15:17:54 +0000
(15:17 +0000)
util/led/sym.c
patch
|
blob
|
history
diff --git
a/util/led/sym.c
b/util/led/sym.c
index
6647d7f
..
9805609
100644
(file)
--- a/
util/led/sym.c
+++ b/
util/led/sym.c
@@
-26,7
+26,7
@@
struct symbol {
ind_t sy_next;
};
-#define NHASH
256 /* Size of hash table. Should be even
. */
+#define NHASH
307 /* Size of hash table. Must be odd
. */
static ind_t hashtable[NHASH];
@@
-134,12
+134,12
@@
int
hash(p)
register char *p;
{
- register unsigned
int
h = 0;
+ register unsigned
short
h = 0;
register int c;
while (c = *p++) {
h <<= 2;
h += c;
}
- return h
& (NHASH - 1)
;
+ return h
% NHASH
;
}