From 6d9e11057708f52c77d81bf13054ce242dea5c78 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 21 Sep 2025 22:25:46 -0700 Subject: [PATCH] math: fix Wshift-overflow warning. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When compiling on x86_64 with -Wshift-overflow=2 you can see the following warning: ../sysdeps/ieee754/flt-32/math_config.h: In function ‘is_inf’: ../sysdeps/ieee754/flt-32/math_config.h:184:37: warning: result of ‘2139095040 << 1’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=] 184 | return (x << 1) == (EXPONENT_MASK << 1); | ^~ This patch adjusts the definitions to use UINT32_C. This matches the definitions in sysdeps/ieee754/dbl-64/math_config.h which use UINT64_C for these definitions. Reviewed-by: H.J. Lu --- sysdeps/ieee754/flt-32/math_config.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sysdeps/ieee754/flt-32/math_config.h b/sysdeps/ieee754/flt-32/math_config.h index 33ea631d5f..6bb5c3324c 100644 --- a/sysdeps/ieee754/flt-32/math_config.h +++ b/sysdeps/ieee754/flt-32/math_config.h @@ -166,11 +166,11 @@ issignalingf_inline (float x) #define MANTISSA_WIDTH 23 #define EXPONENT_WIDTH 8 #define EXPONENT_BIAS 127 -#define MANTISSA_MASK 0x007fffff -#define EXPONENT_MASK 0x7f800000 -#define EXP_MANT_MASK 0x7fffffff -#define QUIET_NAN_MASK 0x00400000 -#define SIGN_MASK 0x80000000 +#define MANTISSA_MASK UINT32_C (0x007fffff) +#define EXPONENT_MASK UINT32_C (0x7f800000) +#define EXP_MANT_MASK UINT32_C (0x7fffffff) +#define QUIET_NAN_MASK UINT32_C (0x00400000) +#define SIGN_MASK UINT32_C (0x80000000) static inline bool is_nan (uint32_t x) -- 2.47.3