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 /Objects/complexobject.c | |
| 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 'Objects/complexobject.c')
| -rw-r--r-- | Objects/complexobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c index c4ced31..c47e0d3 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -397,12 +397,12 @@ complex_repr(PyComplexObject *v) static Py_hash_t complex_hash(PyComplexObject *v) { - unsigned long hashreal, hashimag, combined; - hashreal = (unsigned long)_Py_HashDouble(v->cval.real); - if (hashreal == (unsigned long)-1) + Py_uhash_t hashreal, hashimag, combined; + hashreal = (Py_uhash_t)_Py_HashDouble(v->cval.real); + if (hashreal == (Py_uhash_t)-1) return -1; - hashimag = (unsigned long)_Py_HashDouble(v->cval.imag); - if (hashimag == (unsigned long)-1) + hashimag = (Py_uhash_t)_Py_HashDouble(v->cval.imag); + if (hashimag == (Py_uhash_t)-1) return -1; /* Note: if the imaginary part is 0, hashimag is 0 now, * so the following returns hashreal unchanged. This is @@ -411,8 +411,8 @@ complex_hash(PyComplexObject *v) * hash(x + 0*j) must equal hash(x). */ combined = hashreal + _PyHASH_IMAG * hashimag; - if (combined == (unsigned long)-1) - combined = (unsigned long)-2; + if (combined == (Py_uhash_t)-1) + combined = (Py_uhash_t)-2; return (Py_hash_t)combined; } |
