From 1ccabed64ccbcc40cfa5bac41f9d6af818cc3217 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 18 Jan 2022 10:11:21 +0000 Subject: [PATCH] Fix deduction failure for std::min call This assumes that the literal `64` of type `int` has the same type as the `int32_t` typedef, which is never true for targets with 16-bit `int`, and isn't guaranteed to be true even with 32-bit `int`. --- include/fast_float/digit_comparison.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index 3202718..77c710f 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -86,7 +86,7 @@ fastfloat_really_inline void round(adjusted_mantissa& am, callback cb) noexcept if (-am.power2 >= mantissa_shift) { // have a denormal float int32_t shift = -am.power2 + 1; - cb(am, std::min(shift, 64)); + cb(am, std::min(shift, 64)); // check for round-up: if rounding-nearest carried us to the hidden bit. am.power2 = (am.mantissa < (uint64_t(1) << binary_format::mantissa_explicit_bits())) ? 0 : 1; return;