summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-21 23:54:42 (GMT)
committerGitHub <noreply@github.com>2022-01-21 23:54:42 (GMT)
commitcd8de40b3b10311de2db7b90abdf80af9e35535f (patch)
treedaafa4d41120a0022e2acdf727f0b4fa077fdb79
parentac1f152421fab3ac854fe4565c575b306e2bb4b5 (diff)
downloadcpython-cd8de40b3b10311de2db7b90abdf80af9e35535f.zip
cpython-cd8de40b3b10311de2db7b90abdf80af9e35535f.tar.gz
cpython-cd8de40b3b10311de2db7b90abdf80af9e35535f.tar.bz2
bpo-29882: _Py_popcount32() doesn't need 64x64 multiply (GH-30774)
32x32 bits multiply is enough for _Py_popcount32().
-rw-r--r--Include/internal/pycore_bitutils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/internal/pycore_bitutils.h b/Include/internal/pycore_bitutils.h
index e4aa7a3..3fd70b0 100644
--- a/Include/internal/pycore_bitutils.h
+++ b/Include/internal/pycore_bitutils.h
@@ -125,7 +125,7 @@ _Py_popcount32(uint32_t x)
// Put count of each 8 bits into those 8 bits
x = (x + (x >> 4)) & M4;
// Sum of the 4 byte counts
- return (uint32_t)((uint64_t)x * (uint64_t)SUM) >> 24;
+ return (x * SUM) >> 24;
#endif
}