Skip to content

Commit ce45ff2

Browse files
committed
Fix _BitScanReverse usage
1 parent 65abb83 commit ce45ff2

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
@@ -144,7 +144,7 @@ _Py_bit_length(unsigned long x) {
144144
Py_BUILD_ASSERT(4 == sizeof(unsigned long));
145145
unsigned long msb;
146146
_BitScanReverse(&msb, x);
147-
return 32 - msb;
147+
return msb + 1;
148148
#else
149149
int msb = 0;
150150
while (x != 0) {

0 commit comments

Comments
 (0)