From a777e3090eab4df1780b44fc4ddf353908406501 Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Wed, 1 Aug 2018 13:32:53 +0100 Subject: [PATCH] Fix undeterministic rol32 on ppc64, ppc64le, arm7 and s390x Signed-off-by: Jonathan Dieter --- src/lib/buzhash/buzhash.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/buzhash/buzhash.c b/src/lib/buzhash/buzhash.c index 3c35f5e..f3ed195 100644 --- a/src/lib/buzhash/buzhash.c +++ b/src/lib/buzhash/buzhash.c @@ -25,7 +25,12 @@ #include -#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, -- 2.30.2