From 70a03c778473c88bb2ac55355fc587ba320a2294 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Fri, 30 Jan 2026 15:01:53 +0000 Subject: [PATCH] constify a constant shrinks binary size by 4KB --- src/util/mpz.cpp | 7 ------- src/util/mpz.h | 5 +++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/util/mpz.cpp b/src/util/mpz.cpp index 101ed10a2..a1b01e041 100644 --- a/src/util/mpz.cpp +++ b/src/util/mpz.cpp @@ -133,13 +133,6 @@ mpz_manager::mpz_manager(): m_allocator("mpz_manager") { #ifndef _MP_GMP - if (sizeof(digit_t) == sizeof(uint64_t)) { - // 64-bit machine - m_init_cell_capacity = 4; - } - else { - m_init_cell_capacity = 6; - } set(m_int_min, -static_cast(INT_MIN)); #else // GMP diff --git a/src/util/mpz.h b/src/util/mpz.h index 350835b21..9e7c991f5 100644 --- a/src/util/mpz.h +++ b/src/util/mpz.h @@ -159,8 +159,9 @@ class mpz_manager { mutable mpn_manager m_mpn_manager; #ifndef _MP_GMP - unsigned m_init_cell_capacity; - mpz m_int_min; + // 64-bit machine? + static const unsigned m_init_cell_capacity = sizeof(digit_t) == sizeof(uint64_t) ? 4 : 6; + mpz m_int_min; static unsigned cell_size(unsigned capacity) { return sizeof(mpz_cell) + sizeof(digit_t) * capacity;