Message349349
Currently the hash for integers and several other types uses 62 bits of 64 (on 64-bit platform). The domain of values is continuous:
-sys.hash_info.modulus < h < sys.hash_info.modulus
If interpret Py_hash_t as Py_uhash_t, it will no longer be continuous:
0 <= h < sys.hash_info.modulus or 2**sys.hash_info.width-sys.hash_info.modulus < h < 2**sys.hash_info.width
The hash for tuples is written in term of signed hashes of elements. If write it in Python it will look more complicated for unsigned hashes.
What are problems with using negative hash values? In hash tables you squeeze it to valid range by evaluating `h % size` of `h & mask`. Both expressions give non-negative result. |
|
Date |
User |
Action |
Args |
2019-08-10 18:32:40 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, njs |
2019-08-10 18:32:40 | serhiy.storchaka | set | messageid: <1565461960.41.0.979373812339.issue37807@roundup.psfhosted.org> |
2019-08-10 18:32:40 | serhiy.storchaka | link | issue37807 messages |
2019-08-10 18:32:40 | serhiy.storchaka | create | |
|