File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -547,13 +547,13 @@ static inline uint8_t
547
547
calculate_log2_keysize (Py_ssize_t minsize )
548
548
{
549
549
#if SIZEOF_LONG == SIZEOF_SIZE_T
550
- minsize = (minsize | PyDict_MINSIZE ) - 1 ;
551
- return _Py_bit_length (minsize | ( PyDict_MINSIZE - 1 ) );
550
+ minsize = Py_MAX (minsize , PyDict_MINSIZE );
551
+ return _Py_bit_length (minsize - 1 );
552
552
#elif defined(_MSC_VER )
553
- // On 64bit Windows, sizeof(long) == 4.
554
- minsize = (minsize | PyDict_MINSIZE ) - 1 ;
553
+ // On 64bit Windows, sizeof(long) == 4. We cannot use _Py_bit_length.
554
+ minsize = Py_MAX (minsize , PyDict_MINSIZE );
555
555
unsigned long msb ;
556
- _BitScanReverse64 (& msb , (uint64_t )minsize );
556
+ _BitScanReverse64 (& msb , (uint64_t )minsize - 1 );
557
557
return (uint8_t )(msb + 1 );
558
558
#else
559
559
uint8_t log2_size ;
You can’t perform that action at this time.
0 commit comments