diff --git a/include/fmt/format.h b/include/fmt/format.h index b1e7e589..d4951cb5 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3322,19 +3322,16 @@ template FMT_CONSTEXPR auto iceil(Float value) -> int { auto max = (std::numeric_limits::max)(); ignore_unused(min, max); FMT_ASSERT(value >= min && value <= max, "value not in int range"); - if (is_constant_evaluated()) { - do { - auto mid = min + static_cast((static_cast(max) - - static_cast(min)) / - 2); - if (mid < value) - min = mid; - else - max = mid; - } while (min + 1 != max); - return max; - } - return static_cast(std::ceil(value)); + do { + auto mid = min + static_cast((static_cast(max) - + static_cast(min)) / + 2); + if (mid < value) + min = mid; + else + max = mid; + } while (min + 1 != max); + return max; } template diff --git a/test/format-impl-test.cc b/test/format-impl-test.cc index bbaf3d0f..cdd34164 100644 --- a/test/format-impl-test.cc +++ b/test/format-impl-test.cc @@ -524,22 +524,6 @@ TEST(format_impl_test, to_utf8) { EXPECT_EQ(s.size(), u.size()); } -FMT_CONSTEXPR20 bool constexpr_iceil() { - for (double v : std::initializer_list{ - ((std::numeric_limits::min)() + 0.5), - -1.2, - -0.2, - 0.0, - 0.2, - 1.2, - 4.0, - ((std::numeric_limits::max)() - 0.5), - }) { - auto r = fmt::detail::iceil(v); - fmt::detail::ignore_unused(r); - } - return true; -} TEST(format_impl_test, iceil) { for (double v : std::initializer_list{ ((std::numeric_limits::min)() + 0.5), @@ -553,7 +537,4 @@ TEST(format_impl_test, iceil) { }) { EXPECT_EQ(fmt::detail::iceil(v), static_cast(std::ceil(v))); } - - FMT_CONSTEXPR20 auto result = constexpr_iceil(); - EXPECT_TRUE(result); }