From: Jonathan Dieter Date: Wed, 1 Aug 2018 12:32:53 +0000 (+0100) Subject: Fix undeterministic rol32 on ppc64, ppc64le, arm7 and s390x X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~147 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a777e3090eab4df1780b44fc4ddf353908406501;p=zchunk.git Fix undeterministic rol32 on ppc64, ppc64le, arm7 and s390x Signed-off-by: Jonathan Dieter --- 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,