projects
/
zchunk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
40a0f81
)
Fix undeterministic rol32 on ppc64, ppc64le, arm7 and s390x
author
Jonathan Dieter
<jdieter@gmail.com>
Wed, 1 Aug 2018 12:32:53 +0000
(13:32 +0100)
committer
Jonathan Dieter
<jdieter@gmail.com>
Wed, 1 Aug 2018 12:32:53 +0000
(13:32 +0100)
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
src/lib/buzhash/buzhash.c
patch
|
blob
|
history
diff --git
a/src/lib/buzhash/buzhash.c
b/src/lib/buzhash/buzhash.c
index 3c35f5ee91f31977a053c5c6f1825f81126e2ef5..f3ed195edb930f3fbc4f13bf6f0d0a4b33775a77 100644
(file)
--- a/
src/lib/buzhash/buzhash.c
+++ b/
src/lib/buzhash/buzhash.c
@@
-25,7
+25,12
@@
#include <string.h>
-#define rol32(v,s) (((v) << (s)) | ((v) >> (32 - (s))))
+static uint32_t rol32(uint32_t v, uint32_t s) {
+ s %= 32;
+ if(s == 0)
+ return v;
+ return ((v << s) | (v >> (32 - s)));
+}
const uint32_t buzhash_table[] = {
0x458be752, 0xc10748cc, 0xfbbcdbb8, 0x6ded5b68,