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
547547calculate_log2_keysize (Py_ssize_t  minsize )
548548{
549549#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 );
552552#elif  defined(_MSC_VER )
553-     // On 64bit Windows, sizeof(long) == 4. 
554-     minsize  =  (minsize  | PyDict_MINSIZE ) -  1 ;
553+     // On 64bit Windows, sizeof(long) == 4. So we cannot use _Py_bit_length. 
555554    unsigned long  msb ;
556-     _BitScanReverse64 (& msb , (uint64_t )minsize );
555+     minsize  =  Py_MAX (minsize , PyDict_MINSIZE );
556+     _BitScanReverse64 (& msb , (uint64_t )minsize  -  1 );
557557    return  (uint8_t )(msb  +  1 );
558558#else 
559559    uint8_t  log2_size ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments