@@ -463,8 +463,9 @@ static PyDictValues empty_values_struct = { 0, { NULL }};
463463static inline int
464464get_index_from_order (PyDictObject * mp , int i )
465465{
466- int shift = (mp -> ma_used - 1 - i )* 4 ;
467- return (mp -> ma_values -> mv_order >> shift ) & 15 ;
466+ assert (mp -> ma_used <= 16 );
467+ int shift = (int )(mp -> ma_used - 1 - i )* 4 ;
468+ return (int )(mp -> ma_values -> mv_order >> shift ) & 15 ;
468469}
469470
470471int
@@ -1039,7 +1040,7 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value)
10391040 ep -> me_key = key ;
10401041 ep -> me_hash = hash ;
10411042 if (mp -> ma_values ) {
1042- int index = mp -> ma_keys -> dk_nentries ;
1043+ Py_ssize_t index = mp -> ma_keys -> dk_nentries ;
10431044 assert (index < SHARED_KEYS_MAX_SIZE );
10441045 assert ((mp -> ma_values -> mv_order >> 60 ) == 0 );
10451046 mp -> ma_values -> mv_order = (mp -> ma_values -> mv_order )<<4 | index ;
@@ -1188,7 +1189,7 @@ dictresize(PyDictObject *mp, uint8_t log2_newsize)
11881189 * Note that values of split table is always dense.
11891190 */
11901191 for (Py_ssize_t i = 0 ; i < numentries ; i ++ ) {
1191- int index = oldvalues -> mv_order >> ((numentries - 1 - i )* 4 )& 15 ;
1192+ int index = oldvalues -> mv_order >> ((numentries - 1 - i )* 4 ) & 15 ;
11921193 assert (oldvalues -> values [index ] != NULL );
11931194 PyDictKeyEntry * ep = & oldentries [index ];
11941195 PyObject * key = ep -> me_key ;
@@ -1502,9 +1503,6 @@ _PyDict_GetItemStringWithError(PyObject *v, const char *key)
15021503/* Fast version of global value lookup (LOAD_GLOBAL).
15031504 * Lookup in globals, then builtins.
15041505 *
1505- *
1506- *
1507- *
15081506 * Raise an exception and return NULL if an error occurred (ex: computing the
15091507 * key hash failed, key comparison failed, ...). Return NULL if the key doesn't
15101508 * exist. Return the value if the key exists.
@@ -1616,7 +1614,7 @@ delitem_common(PyDictObject *mp, Py_hash_t hash, Py_ssize_t ix,
16161614 if (((mp -> ma_values -> mv_order >> i ) & 15 ) == (uint64_t )ix ) {
16171615 /* Remove 4 bits at ith position */
16181616 uint64_t order = mp -> ma_values -> mv_order ;
1619- uint64_t high = order >> i >> 4 << i ;
1617+ uint64_t high = (( order >> i )>> 4 )<< i ;
16201618 uint64_t low = order & ((((uint64_t )1 )<<i )- 1 );
16211619 mp -> ma_values -> mv_order = high | low ;
16221620 break ;
@@ -3012,7 +3010,7 @@ PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *defaultobj)
30123010 ep -> me_key = key ;
30133011 ep -> me_hash = hash ;
30143012 if (_PyDict_HasSplitTable (mp )) {
3015- int index = mp -> ma_keys -> dk_nentries ;
3013+ int index = ( int ) mp -> ma_keys -> dk_nentries ;
30163014 assert (index < SHARED_KEYS_MAX_SIZE );
30173015 assert (mp -> ma_values -> values [index ] == NULL );
30183016 mp -> ma_values -> values [index ] = value ;
0 commit comments