8000 bpo-46311: Clean up PyLong_FromLong and PyLong_FromLongLong by mdickinson · Pull Request #30496 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-46311: Clean up PyLong_FromLong and PyLong_FromLongLong #30496

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

Merged
merged 3 commits into from
Mar 1, 2022
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Silence compiler warnings
  • Loading branch information
mdickinson authored Jan 22, 2022
commit d7c7fe072f21afd331b9fe0b92e4c3c5babd7edd
4 changes: 2 additions & 2 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ PyLong_FromLong(long ival)
}

/* Count digits (at least two - smaller cases were handled above). */
abs_ival = ival < 0 ? 0U-(unsigned long)ival : ival;
abs_ival = ival < 0 ? 0U-(unsigned long)ival : (unsigned long)ival;
/* Do shift in two steps to avoid possible undefined behavior. */
t = abs_ival >> PyLong_SHIFT >> PyLong_SHIFT;
ndigits = 2;
Expand Down Expand Up @@ -1115,7 +1115,7 @@ PyLong_FromLongLong(long long ival)
}

/* Count digits (at least two - smaller cases were handled above). */
abs_ival = ival < 0 ? 0U-(unsigned long long)ival : ival;
abs_ival = ival < 0 ? 0U-(unsigned long long)ival : (unsigned long long)ival;
/* Do shift in two steps to avoid possible undefined behavior. */
t = abs_ival >> PyLong_SHIFT >> PyLong_SHIFT;
ndigits = 2;
Expand Down
0