diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-23 16:20:50 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-23 16:20:50 (GMT) |
commit | 8035bc5c048ff08f652649754eb8ea769337afa0 (patch) | |
tree | 82778e9f0242d5a26e4ceba5d5b85babde6c12cf /Include/pyport.h | |
parent | 2b9af63b4f4757cccad70b76960cfe8c7b9e6a49 (diff) | |
download | cpython-8035bc5c048ff08f652649754eb8ea769337afa0.zip cpython-8035bc5c048ff08f652649754eb8ea769337afa0.tar.gz cpython-8035bc5c048ff08f652649754eb8ea769337afa0.tar.bz2 |
follow up to #9778: define and use an unsigned hash type
Diffstat (limited to 'Include/pyport.h')
-rw-r--r-- | Include/pyport.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index 4331bf9..568199b 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -135,7 +135,7 @@ Used in: PY_LONG_LONG #else #define _PyHASH_BITS 31 #endif -#define _PyHASH_MODULUS ((1UL << _PyHASH_BITS) - 1) +#define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) #define _PyHASH_INF 314159 #define _PyHASH_NAN 0 #define _PyHASH_IMAG 1000003UL @@ -179,6 +179,8 @@ typedef Py_intptr_t Py_ssize_t; /* Py_hash_t is the same size as a pointer. */ typedef Py_ssize_t Py_hash_t; +/* Py_uhash_t is the unsigned equivalent needed to calculate numeric hash. */ +typedef size_t Py_uhash_t; /* Largest possible value of size_t. SIZE_MAX is part of C99, so it might be defined on some |