From 7654ab4b723fbbc754d93fd0f016f70fbfed1478 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 18:24:50 +0000 Subject: [PATCH] Fix SMALL_BITS constant reference to use direct calculation instead Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com> --- src/util/mpz.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/mpz.cpp b/src/util/mpz.cpp index 5a1e77caf..5835a86cc 100644 --- a/src/util/mpz.cpp +++ b/src/util/mpz.cpp @@ -2277,7 +2277,8 @@ unsigned mpz_manager::power_of_two_multiple(mpz const & a) { uint64_t v; if (val == mpz::SMALL_INT_MIN) { // SMALL_INT_MIN = -2^(SMALL_BITS-1), so it has (SMALL_BITS-1) trailing zeros - return mpz::SMALL_BITS - 1; + // On 32-bit: return 30, on 64-bit: return 62 + return (sizeof(uintptr_t) * 8 - 1) - 1; } else if (val < 0) { v = static_cast(-val); } else { @@ -2389,7 +2390,7 @@ unsigned mpz_manager::mlog2(mpz const & a) { // Special case: negating SMALL_INT_MIN would overflow // For 32-bit: SMALL_INT_MIN = -2^30, so log2(2^30) = 30 // For 64-bit: SMALL_INT_MIN = -2^62, so log2(2^62) = 62 - return mpz::SMALL_BITS - 1; + return (sizeof(uintptr_t) * 8 - 1) - 1; } return uint64_log2(static_cast(-v)); }