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 <hjl.tools@gmail.com>
#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)