From 248c6b55fb486378e44360a65a8c56d0fefbd7cb Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Sun, 23 Mar 2025 10:31:55 +0100 Subject: [PATCH 1/2] fix clangcl warning for 32bit builds --- Objects/longobject.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Objects/longobject.c b/Objects/longobject.c index 984381ff4969d0..7fcdd5ccff8f94 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -909,7 +909,9 @@ _PyLong_NumBits(PyObject *vv) assert(ndigits == 0 || v->long_value.ob_digit[ndigits - 1] != 0); if (ndigits > 0) { digit msd = v->long_value.ob_digit[ndigits - 1]; +#if SIZEOF_SIZE_T > 4 assert(ndigits <= INT64_MAX / PyLong_SHIFT); +#endif result = (int64_t)(ndigits - 1) * PyLong_SHIFT; msd_bits = bit_length_digit(msd); result += msd_bits; From dd92ba1bfb28cd9142eaf21a89fd6c6d6b2eb9f0 Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Thu, 17 Apr 2025 18:27:49 +0200 Subject: [PATCH 2/2] use SIZEOF_SIZE_T == 8 --- Objects/longobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/longobject.c b/Objects/longobject.c index 7fcdd5ccff8f94..ef72dbd9793f24 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -909,7 +909,7 @@ _PyLong_NumBits(PyObject *vv) assert(ndigits == 0 || v->long_value.ob_digit[ndigits - 1] != 0); if (ndigits > 0) { digit msd = v->long_value.ob_digit[ndigits - 1]; -#if SIZEOF_SIZE_T > 4 +#if SIZEOF_SIZE_T == 8 assert(ndigits <= INT64_MAX / PyLong_SHIFT); #endif result = (int64_t)(ndigits - 1) * PyLong_SHIFT;