8000 gh-100239: specialize left and right shift ops on ints by eendebakpt · Pull Request #129431 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100239: specialize left and right shift ops on ints #129431

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
tighten guard
  • Loading branch information
eendebakpt committed Jan 29, 2025
commit 32c68aefa4d5095030b1aef87de42d95da8fc979
2 changes: 1 addition & 1 deletion Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ shift_guard(PyObject *lhs, PyObject *rhs)

// rshift with value larger the the number of bits is undefined in C
// for lshift we do not want to overflow, but we always have at least 16 bits available
return (is_compactlong(lhs) && is_compactnonnegativelong(rhs) && (_PyLong_CompactValue((PyLongObject *)rhs) <= 16) );
return (is_compactlong(lhs) && is_compactnonnegativelong(rhs) && (_PyLong_CompactValue((PyLongObject *)rhs) <= 12) );
}

#define BITWISE_LONGS_ACTION(NAME, OP) \
Expand Down
Loading
0