From f2ae873fdecbda2dec7fd45d14a4a4171756b284 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:49:20 +0000 Subject: [PATCH] Remove nonsensical assertion and revert to simpler shift for SMALL_INT constants Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com> --- src/util/mpz.cpp | 1 - src/util/mpz.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/mpz.cpp b/src/util/mpz.cpp index 2d9768758..b877c700b 100644 --- a/src/util/mpz.cpp +++ b/src/util/mpz.cpp @@ -939,7 +939,6 @@ void mpz_manager::big_rem(mpz const & a, mpz const & b, mpz & c) { template void mpz_manager::gcd(mpz const & a, mpz const & b, mpz & c) { - static_assert(sizeof(int) == sizeof(int), "size mismatch"); static_assert(sizeof(mpz) <= 16, "mpz size overflow"); if (is_small(a) && is_small(b)) { int64_t _a = a.value64(); diff --git a/src/util/mpz.h b/src/util/mpz.h index 68bae1914..5d1f30c7d 100644 --- a/src/util/mpz.h +++ b/src/util/mpz.h @@ -99,9 +99,8 @@ private: static constexpr int SMALL_BITS = sizeof(uintptr_t) * 8 - 1; // Maximum and minimum values that can be stored as small integers - // Use unsigned arithmetic to avoid undefined behavior on left shift - static constexpr int64_t SMALL_INT_MAX = (static_cast(1) << (SMALL_BITS - 1)) - 1; - static constexpr int64_t SMALL_INT_MIN = -(static_cast(static_cast(1) << (SMALL_BITS - 1))); + static constexpr int64_t SMALL_INT_MAX = (static_cast(1) << (SMALL_BITS - 1)) - 1; + static constexpr int64_t SMALL_INT_MIN = -(static_cast(1) << (SMALL_BITS - 1)); static bool fits_in_small(int64_t v) { return v >= SMALL_INT_MIN && v <= SMALL_INT_MAX;