SIGN IN SIGN UP

gh-129149: Add fast path for medium-sized integers in `PyLong_FromSsize_t()` (#129301)

The implementation of `PyLong_FromLong()`, `PyLong_FromLongLong()` and `PyLong_FromSsize_t()`
are now handled by a common macro `PYLONG_FROM_INT` which contains fast paths depending on the
size of the integer to convert. Consequently, `PyLong_FromSsize_t()` for medium-sized integers is faster
by roughly 25%.

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
C
Chris Eibl committed
119bcfad9cac9ac8fa5fa6c0f3ee3ccfca778fe1
Parent: a005835
Committed by GitHub <noreply@github.com> on 3/13/2025, 11:06:56 AM