Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
0ce377a
gh-111389: restoring _PyHASH_INF/BITS/MODULUS/IMAG macroses as public
skirpichevOct 28, 2023
2c6002f
Mention public macros in docs
skirpichevOct 29, 2023
5c42cae
Revert "Mention public macros in docs"
skirpichevOct 30, 2023
de4e3ae
Add Doc/c-api/hashing.rst for hash-related C macros
skirpichevOct 30, 2023
1a50a7b
Expose macroses as unstable API
skirpichevOct 31, 2023
ebe7604
Merge branch 'main' into restore-pyhash-and-pylongnew
skirpichevNov 15, 2023
b7a7ce3
Merge branch 'main' into restore-pyhash-and-pylongnew
skirpichevNov 15, 2023
7080fa9
Expose macros as public and move docs to Doc/c-api/hash.rst
skirpichevNov 15, 2023
9fcd93e
news entry
skirpichevNov 15, 2023
0cc4ff3
restore link to hashing algorithms
skirpichevNov 15, 2023
d978fdb
Merge branch 'main' into restore-pyhash-and-pylongnew
skirpichevNov 16, 2023
00bc891
Update Misc/NEWS.d/next/C API/2023-11-15-09-24-51.gh-issue-111418.FYY…
skirpichevNov 16, 2023
6aaa610
address review: versionadded
skirpichevNov 16, 2023
a8dec64
Move to Include/cpython/pyhash.h
skirpichevNov 16, 2023
d3a61ce
docs nitpick
skirpichevNov 16, 2023
1f3b623
Apply suggestions from code review
skirpichevMar 8, 2024
1dd0fe7
Apply suggestions from review: keep deprecated names as aliases
skirpichevMar 8, 2024
553c663
Add comment
skirpichevMar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Move to Include/cpython/pyhash.h
  • Loading branch information
@skirpichev
skirpichev committedNov 16, 2023
commita8dec64eb606d0e980cf55410ea09da0f4ad19f5
5 changes: 5 additions & 0 deletionsInclude/cpython/pyhash.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,9 +15,14 @@
# define_PyHASH_BITS 31
#endif

#definePyHASH_BITS _PyHASH_BITS

#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);
Expand Down
22 changes: 0 additions & 22 deletionsInclude/pyhash.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,28 +4,6 @@
extern "C" {
#endif

/* Prime multiplier used in string and various other hashes. */
#define _PyHASH_MULTIPLIER 1000003UL /* 0xf4243 */

/* Parameters used for the numeric hash implementation. See notes for
_Py_HashDouble in Python/pyhash.c. Numeric hashes are based on
reduction modulo the prime 2**_PyHASH_BITS - 1. */

#if SIZEOF_VOID_P >= 8
# define _PyHASH_BITS 61
#else
# define _PyHASH_BITS 31
#endif

#define PyHASH_BITS _PyHASH_BITS

#define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
#define PyHASH_MODULUS _PyHASH_MODULUS
#define _PyHASH_INF 314159
#define PyHASH_INF _PyHASH_INF
#define _PyHASH_IMAG _PyHASH_MULTIPLIER
#define PyHASH_IMAG _PyHASH_IMAG

/* Cutoff for small string DJBX33A optimization in range [1, cutoff).
*
* About 50% of the strings in a typical Python application are smaller than
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp