diff options
author | Inada Naoki <songofacandy@gmail.com> | 2022-02-22 20:03:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 11:03:15 +0000 |
commit | 1e344684d8d42206858c4eca8ec7950e644f4220 (patch) | |
tree | ef191fc7e4174401fb2c98675b277626b1c58fa9 /Include/internal/pycore_dict.h | |
parent | 090e5c4b946b28f50fce445916c5d3ec45c8f45f (diff) | |
download | cpython-git-1e344684d8d42206858c4eca8ec7950e644f4220.tar.gz |
dict: Add dk_log2_index_bytes (GH-31439)
Diffstat (limited to 'Include/internal/pycore_dict.h')
-rw-r--r-- | Include/internal/pycore_dict.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Include/internal/pycore_dict.h b/Include/internal/pycore_dict.h index 64d70d187d..9cd652b2fb 100644 --- a/Include/internal/pycore_dict.h +++ b/Include/internal/pycore_dict.h @@ -68,6 +68,9 @@ struct _dictkeysobject { /* Size of the hash table (dk_indices). It must be a power of 2. */ uint8_t dk_log2_size; + /* Size of the hash table (dk_indices) by bytes. */ + uint8_t dk_log2_index_bytes; + /* Kind of keys */ uint8_t dk_kind; @@ -129,7 +132,7 @@ struct _dictvalues { 2 : sizeof(int32_t)) #endif #define DK_ENTRIES(dk) \ - ((PyDictKeyEntry*)(&((int8_t*)((dk)->dk_indices))[DK_SIZE(dk) * DK_IXSIZE(dk)])) + ((PyDictKeyEntry*)(&((int8_t*)((dk)->dk_indices))[(size_t)1 << (dk)->dk_log2_index_bytes])) extern uint64_t _pydict_global_version; |