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
NextNext commit
gh-111389: restoring _PyHASH_INF/BITS/MODULUS/IMAG macroses as public
This partially reverts#107026.
  • Loading branch information
@skirpichev
skirpichev committedOct 28, 2023
commit0ce377a5933a55b05e0ba5cdac243f978f8efb11
17 changes: 0 additions & 17 deletionsInclude/internal/pycore_pyhash.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,23 +17,6 @@ extern Py_hash_t _Py_HashPointerRaw(const void*);
// Export for '_datetime' shared extension
PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t);

/* 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_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
#define _PyHASH_INF 314159
#define _PyHASH_IMAG _PyHASH_MULTIPLIER

/* Hash secret
*
* memory layout on 64 bit systems
Expand Down
16 changes: 16 additions & 0 deletionsInclude/pyhash.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,22 @@ typedef struct {
PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
#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_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
#define _PyHASH_INF 314159
#define _PyHASH_IMAG _PyHASH_MULTIPLIER

/* Cutoff for small string DJBX33A optimization in range [1, cutoff).
*
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp