Skip to content

Commit

Permalink
opr: Make opr_jhash_opaque consistent with opr_jhash
Browse files Browse the repository at this point in the history
Change-Id: I42e1030f8c841dcb974476012a774b91c87d3fb0
Reviewed-on: https://gerrit.openafs.org/12494
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
  • Loading branch information
andersk authored and kaduk committed Dec 22, 2016
1 parent 958120b commit 5151c03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/opr/jhash.h
Expand Up @@ -125,7 +125,7 @@ opr_jhash_opaque(const void *val, size_t length, afs_uint32 initval)
afs_uint32 a,b,c;

/* Set up the internal state */
a = b = c = 0xdeadbeef + (((afs_uint32)length)<<2) + initval;
a = b = c = 0xdeadbeef + ((afs_uint32)length) + initval;

while (length > 12) {
a += (afs_uint32) str[3]<<24 |
Expand Down
4 changes: 2 additions & 2 deletions tests/opr/jhash-t.c
Expand Up @@ -65,10 +65,10 @@ main(int argc, char **argv)
is_int(0xdeadbeef, opr_jhash_opaque("", 0, 0),
"Hashing an empty string works");

is_int(2748273291UL,
is_int(393676113,
opr_jhash_opaque("Four score and seven years ago", 30, 0),
"Hashing a string with a 0 initval works");
is_int(1389900913,
is_int(3445784929UL,
opr_jhash_opaque("Four score and seven years ago", 30, 1),
"Hashing a string with a 1 initval works");
return 0;
Expand Down

0 comments on commit 5151c03

Please sign in to comment.