summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-01-14 15:31:34 -0800
committerGregory P. Smith <greg@krypto.org>2012-01-14 15:31:34 -0800
commita9cb20e5d95127a2f8bbedf914546517203f7a72 (patch)
tree4e8c3c81ca5b240e3924990719bfca1a79abe31e /Include
parent6b57a4687148b1a756a8f255c5d65af8b22196e3 (diff)
downloadcpython-a9cb20e5d95127a2f8bbedf914546517203f7a72.tar.gz
Consolidate the occurrances of the prime used as the multiplier when hashing
to a single #define instead of having several copies in several files. This excludes the Modules/ tree (datetime and expat both have a copy for their own purposes with no need for it to be the same).
Diffstat (limited to 'Include')
-rw-r--r--Include/pyport.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 62aa53ae21..269ba68e68 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -131,6 +131,9 @@ Used in: PY_LONG_LONG
#endif
#endif
+/* Prime multiplier used in string and various other hashes. */
+#define _PyHASH_MULTIPLIER 1000003 /* 0xf4243 */
+
/* Parameters used for the numeric hash implementation. See notes for
_PyHash_Double in Objects/object.c. Numeric hashes are based on
reduction modulo the prime 2**_PyHASH_BITS - 1. */
@@ -143,7 +146,7 @@ Used in: PY_LONG_LONG
#define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
#define _PyHASH_INF 314159
#define _PyHASH_NAN 0
-#define _PyHASH_IMAG 1000003UL
+#define _PyHASH_IMAG _PyHASH_MULTIPLIER
/* uintptr_t is the C9X name for an unsigned integral type such that a
* legitimate void* can be cast to uintptr_t and then back to void* again