Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-111389: expose _PyHASH_INF/BITS/MODULUS/IMAG macros as public#111418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from15 commits
0ce377a2c6002f5c42caede4e3ae1a50a7bebe7604b7a7ce37080fa99fcd93e0cc4ff3d978fdb00bc8916aaa610a8dec64d3a61ce1f3b6231dd0fe7553c663File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,7 +3,7 @@ | ||
| PyHash API | ||
| ---------- | ||
| See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`. | ||
| .. c:type:: Py_hash_t | ||
| @@ -17,6 +17,29 @@ See also the :c:member:`PyTypeObject.tp_hash` member. | ||
| .. versionadded:: 3.2 | ||
| .. c:macro:: PyHASH_MODULUS | ||
| The Mersenne prime ``P = 2**n -1``, used for numeric hash scheme. | ||
skirpichev marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page.
skirpichev marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| .. versionadded:: 3.13 | ||
| .. c:macro:: PyHASH_BITS | ||
| The exponent ``n`` of ``P``. | ||
skirpichev marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| .. versionadded:: 3.13 | ||
| .. c:macro:: PyHASH_INF | ||
| The hash value returned for a positive infinity. | ||
| .. versionadded:: 3.13 | ||
| .. c:macro:: PyHASH_IMAG | ||
| The multiplier used for the imaginary part of a complex number. | ||
| .. versionadded:: 3.13 | ||
| .. c:type:: PyHash_FuncDef | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -15,9 +15,14 @@ | ||
| # define_PyHASH_BITS 31 | ||
| #endif | ||
| #definePyHASH_BITS _PyHASH_BITS | ||
skirpichev marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| #define_PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) | ||
| #definePyHASH_MODULUS _PyHASH_MODULUS | ||
| #define_PyHASH_INF 314159 | ||
| #definePyHASH_INF _PyHASH_INF | ||
| #define_PyHASH_IMAG _PyHASH_MULTIPLIER | ||
| #definePyHASH_IMAG _PyHASH_IMAG | ||
| /* Helpers for hash functions */ | ||
| PyAPI_FUNC(Py_hash_t)_Py_HashDouble(PyObject*,double); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add :c:macro:`PyHASH_MODULUS`, :c:macro:`PyHASH_BITS`, :c:macro:`PyHASH_INF` | ||
| and :c:macro:`PyHASH_IMAG` C macros. Patch by Sergey B Kirpichev. |