opr: Make opr_jhash_opaque consistent with opr_jhash

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>
This commit is contained in:
Anders Kaseorg 2016-12-16 03:04:18 -05:00 committed by Benjamin Kaduk
parent 958120b89d
commit 5151c03351
2 changed files with 3 additions and 3 deletions

View File

@ -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 |

View File

@ -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;