From 2f4d634061fb5a537c1ce0b58a9c985b328a9327 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Sep 2023 07:56:53 +0200 Subject: compat/math: fix ceil() for negative numbers --- compat/math.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/compat/math.hpp b/compat/math.hpp index d5b628c4..8df83cc3 100644 --- a/compat/math.hpp +++ b/compat/math.hpp @@ -62,15 +62,11 @@ constexpr inline T ceil(T x) { if (std::is_constant_evaluated()) { -#ifdef __GNUG__ - return __builtin_ceil(x); -#else - const auto x0 = uint64_t(x); + const auto x0 = int64_t(x); if (x > x0) - return T(x0 + uint64_t(1)); + return T(x0 + int64_t(1)); else return x0; -#endif } else return std::ceil(x); -- cgit v1.2.3