- 1 byte if dk_size <= 0xff (char*)
- 2 bytes if dk_size <= 0xffff (int16_t*)
- 4 bytes if dk_size <= 0xffffffff (int32_t*)
- - 8 bytes otherwise (Py_ssize_t*)
+ - 8 bytes otherwise (int64_t*)
Dynamically sized, 8 is minimum. */
union {
int8_t as_1[8];
int16_t as_2[4];
int32_t as_4[2];
+#if SIZEOF_VOID_P > 4
int64_t as_8[1];
+#endif
} dk_indices;
/* "PyDictKeyEntry dk_entries[dk_usable];" array follows:
static int dictresize(PyDictObject *mp, Py_ssize_t minused);
-/* Global counter used to set ma_version_tag field of dictionary.
+/*Global counter used to set ma_version_tag field of dictionary.
* It is incremented each time that a dictionary is created and each
* time that a dictionary is modified. */
static uint64_t pydict_global_version = 0;
(DK_SIZE(dk) <= 0xff ? \
1 : DK_SIZE(dk) <= 0xffff ? \
2 : DK_SIZE(dk) <= 0xffffffff ? \
- 4 : sizeof(Py_ssize_t))
+ 4 : sizeof(int64_t))
#else
#define DK_IXSIZE(dk) \
(DK_SIZE(dk) <= 0xff ? \
1 : DK_SIZE(dk) <= 0xffff ? \
- 2 : sizeof(Py_ssize_t))
+ 2 : sizeof(int32_t))
#endif
#define DK_ENTRIES(dk) \
((PyDictKeyEntry*)(&(dk)->dk_indices.as_1[DK_SIZE(dk) * DK_IXSIZE(dk)]))
int32_t *indices = keys->dk_indices.as_4;
ix = indices[i];
}
+#if SIZEOF_VOID_P > 4
else {
int64_t *indices = keys->dk_indices.as_8;
ix = indices[i];
}
+#endif
assert(ix >= DKIX_DUMMY);
return ix;
}
assert(ix <= 0x7fffffff);
indices[i] = (int32_t)ix;
}
+#if SIZEOF_VOID_P > 4
else {
int64_t *indices = keys->dk_indices.as_8;
indices[i] = ix;
}
+#endif
}