-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-129149: Add fast path for medium-size integers in PyLong_FromSsize_t()
#129301
base: main
Are you sure you want to change the base?
Conversation
Use it in PyLong_FromLong() and PyLong_FromLongLong(). This is just a refactoring and will create the same binary code.
Use it in now in PyLong_FromSsize_t(), too.
PyLong_FromSsize_t
PyLong_FromSsize_t()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Few stylistic nitpicks, feel free to ignore.
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
I like your suggestions, brings us more in sync with |
BTW, next time you can apply several suggestions in one shot (subscribers will get less notifications): it's possible add them in one batch (on tab "files changed"). |
Great, will do! I've done some more syncs with PYLONG_FROM_UINT, if we want to keep the diff small, we can remove (all of) them. |
Add the macro
PYLONG_FROM_INT
and use it inPyLong_FromLong()
andPyLong_FromLongLong()
.There, this is just a binary compatible refactoring.
Use it in
PyLong_FromSsize_t()
, too, to get the fast path for medium-size integers.