summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/hashtable.c2
-rw-r--r--Python/pyhash.c22
2 files changed, 6 insertions, 18 deletions
diff --git a/Python/hashtable.c b/Python/hashtable.c
index 8f5e816..faf68fe 100644
--- a/Python/hashtable.c
+++ b/Python/hashtable.c
@@ -45,7 +45,7 @@
*/
#include "Python.h"
-#include "pycore_hashtable.h"
+#include "pycore_hashtable.h" // export _Py_hashtable_new()
#include "pycore_pyhash.h" // _Py_HashPointerRaw()
#define HASHTABLE_MIN_SIZE 16
diff --git a/Python/pyhash.c b/Python/pyhash.c
index f9060b8..141407c 100644
--- a/Python/pyhash.c
+++ b/Python/pyhash.c
@@ -83,8 +83,6 @@ static Py_ssize_t hashstats[Py_HASH_STATS_MAX + 1] = {0};
*/
-Py_hash_t _Py_HashPointer(const void *);
-
Py_hash_t
_Py_HashDouble(PyObject *inst, double v)
{
@@ -132,23 +130,13 @@ _Py_HashDouble(PyObject *inst, double v)
}
Py_hash_t
-_Py_HashPointerRaw(const void *p)
-{
- size_t y = (size_t)p;
- /* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
- excessive hash collisions for dicts and sets */
- y = (y >> 4) | (y << (8 * SIZEOF_VOID_P - 4));
- return (Py_hash_t)y;
-}
-
-Py_hash_t
-_Py_HashPointer(const void *p)
+Py_HashPointer(const void *ptr)
{
- Py_hash_t x = _Py_HashPointerRaw(p);
- if (x == -1) {
- x = -2;
+ Py_hash_t hash = _Py_HashPointerRaw(ptr);
+ if (hash == -1) {
+ hash = -2;
}
- return x;
+ return hash;
}
Py_hash_t