8000 bpo-29882: _Py_popcount32() doesn't need 64x64 multiply (GH-30774) · python/cpython@cd8de40 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd8de40

Browse files
authored
bpo-29882: _Py_popcount32() doesn't need 64x64 multiply (GH-30774)
32x32 bits multiply is enough for _Py_popcount32().
1 parent ac1f152 commit cd8de40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Include/internal/pycore_bitutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ _Py_popcount32(uint32_t x)
125125
// Put count of each 8 bits into those 8 bits
126126
x = (x + (x >> 4)) & M4;
127127
// Sum of the 4 byte counts
128-
return (uint32_t)((uint64_t)x * (uint64_t)SUM) >> 24;
128+
return (x * SUM) >> 24;
129129
#endif
130130
}
131131

0 commit comments

Comments
 (0)
0