Avoid shift of negative, which is undefined in C.
authorTaylor R Campbell <campbell@mumble.net>
Sun, 21 Jan 2018 15:52:51 +0000 (15:52 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sun, 21 Jan 2018 15:52:51 +0000 (15:52 +0000)
src/microcode/bignmint.h

index d1c3c02cc4e13fc207e2173b3506f7bfd5094ada..8f9d904a5673e292a1ca90f2001551fb7a0f1626 100644 (file)
@@ -118,7 +118,8 @@ extern void abort ();
   ((BIGNUM_RADIX / BIGNUM_DIGIT_LENGTH) - BIGNUM_DIGIT_LENGTH)
 
 #define BIGNUM_DIGIT(c) ((bignum_digit_type) (c))
-#define BIGNUM_DIGIT_ONES(n) (~ ((~ (BIGNUM_DIGIT (0))) << (n)))
+#define BIGNUM_DIGIT_ONES(n)                                           \
+  ((bignum_digit_type) (~ ((~ ((uintmax_t) (0))) << (n))))
 
 #define BIGNUM_START_PTR(bignum)                                       \
   ((BIGNUM_TO_POINTER (bignum)) + 1)