From e7817b5904bb79eb1878362c63aa538ce73eb7d0 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 2 Nov 2022 02:17:16 +0200 Subject: [PATCH 48/48] Bitvector: Fix clang++ -Wtautological-constant-out-of-range-compare warning See osdn #45998 Signed-off-by: Marko Lindqvist --- utility/bitvector.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utility/bitvector.h b/utility/bitvector.h index e48e46d856..1147135598 100644 --- a/utility/bitvector.h +++ b/utility/bitvector.h @@ -61,12 +61,15 @@ void dbv_debug(struct dbv *pdbv); #define _BV_BYTES(bits) ((((bits) - 1) / 8) + 1) #define _BV_BYTE_INDEX(bits) ((bits) / 8) #define _BV_BITMASK(bit) (1u << ((bit) & 0x7)) + #ifdef FREECIV_DEBUG -# define _BV_ASSERT(bv, bit) fc_assert((bit) >= 0 \ - && (bit) < (signed int) sizeof((bv).vec) * 8) +#define _BV_ASSERT(bv, bit) \ + fc_assert((signed int)(bit) >= 0 \ + && (signed int)(bit) < (signed int) sizeof((bv).vec) * 8) #else -# define _BV_ASSERT(bv, bit) (void)0 +#define _BV_ASSERT(bv, bit) (void)0 #endif + #define BV_ISSET(bv, bit) \ (_BV_ASSERT(bv, bit), \ ((bv).vec[_BV_BYTE_INDEX(bit)] & _BV_BITMASK(bit)) != 0) -- 2.35.1