diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-17 20:54:53 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-17 20:54:53 (GMT) |
commit | 8f67d0893f7170986b0ad370844318544270cbcc (patch) | |
tree | 4aec6cf093d4d042d18d1fadc3ce52765d32bd8d /Include/setobject.h | |
parent | 6fb457526cef485d64f4f6744d81cae8c02032b3 (diff) | |
download | cpython-8f67d0893f7170986b0ad370844318544270cbcc.zip cpython-8f67d0893f7170986b0ad370844318544270cbcc.tar.gz cpython-8f67d0893f7170986b0ad370844318544270cbcc.tar.bz2 |
make hashes always the size of pointers; introduce Py_hash_t #9778
Diffstat (limited to 'Include/setobject.h')
-rw-r--r-- | Include/setobject.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Include/setobject.h b/Include/setobject.h index 574caf7..023c5fa 100644 --- a/Include/setobject.h +++ b/Include/setobject.h @@ -22,11 +22,8 @@ no meaning otherwise. #define PySet_MINSIZE 8 typedef struct { - /* Cached hash code of the key. Note that hash codes are C longs. - * We have to use Py_ssize_t instead because set_pop() abuses - * the hash field to hold a search finger. - */ - Py_ssize_t hash; + /* Cached hash code of the key. */ + Py_hash_t hash; PyObject *key; } setentry; @@ -53,10 +50,10 @@ struct _setobject { * saves repeated runtime null-tests. */ setentry *table; - setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); + setentry *(*lookup)(PySetObject *so, PyObject *key, Py_hash_t hash); setentry smalltable[PySet_MINSIZE]; - long hash; /* only used by frozenset objects */ + Py_hash_t hash; /* only used by frozenset objects */ PyObject *weakreflist; /* List of weak references */ }; @@ -93,7 +90,7 @@ PyAPI_FUNC(int) PySet_Clear(PyObject *set); PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); -PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash); +PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, Py_hash_t *hash); PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); |