From: Joseph Sutton Date: Wed, 19 Apr 2023 22:44:41 +0000 (+1200) Subject: lib:util: Fix undefined bitshift X-Git-Tag: talloc-2.4.1~755 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=443d70ee58f3dec05ddede22c33fec0860f52864;p=thirdparty%2Fsamba.git lib:util: Fix undefined bitshift runtime error: left shift of 65535 by 16 places cannot be represented in type 'int' Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h index 26268ac93cd..e8664e95538 100644 --- a/lib/util/byteorder.h +++ b/lib/util/byteorder.h @@ -138,7 +138,7 @@ it also defines lots of intermediate macros, just ignore those :-) /* now the reverse routines - these are used in nmb packets (mostly) */ #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) -#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) +#define IREV(x) ((SREV((uint32_t)x)<<16) | (SREV(((uint32_t)x)>>16))) #define BREV(x) ((IREV((uint64_t)x)<<32) | (IREV(((uint64_t)x)>>32))) /****************************************************************************