◐ Shell
reader mode source ↗
Skip to content

bpo-31031: Unify duplicate bits_in_digit and bit_length#2866

Merged
vstinner merged 1 commit into
python:masterfrom
niklasf:bpo-31031-consolidate-bit-length
Jan 16, 2020
Merged

bpo-31031: Unify duplicate bits_in_digit and bit_length#2866
vstinner merged 1 commit into
python:masterfrom
niklasf:bpo-31031-consolidate-bit-length

Conversation

@niklasf

@niklasf niklasf commented Jul 25, 2017

Copy link
Copy Markdown
Contributor

@auvipy auvipy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

check the build errors plz

@niklasf niklasf force-pushed the bpo-31031-consolidate-bit-length branch from ccdbe59 to 900f7a8 Compare June 2, 2019 14:15
@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@niklasf niklasf force-pushed the bpo-31031-consolidate-bit-length branch 2 times, most recently from f225c8e to dcaa962 Compare June 5, 2019 10:07
@niklasf

niklasf commented Jun 5, 2019

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing. I have made the requested changes; please review again.

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

@niklasf niklasf force-pushed the bpo-31031-consolidate-bit-length branch from dcaa962 to 7b4198c Compare June 12, 2019 14:42

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

LGTM.

@vstinner

Copy link
Copy Markdown
Member

Thanks @niklasf, sorry for slow reviews and for being so pedantic :-) But it was worth it, I like the final change ;-)

I looked again at rejected https://bugs.python.org/issue29782 and #594 I was going to ask further change on this PR to prepare the code in case if someone wants to experiment again more efficient functions... But nah, the code is ok and can be updated later.

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length().
niklasf added a commit to niklasf/cpython that referenced this pull request Jun 8, 2020
In pythonGH-2866, _Py_Bit_Length() was added to pymath.h for lack of a better
location. pythonGH-20518 added a more appropriate header file for bit utilities. It
also shows how to properly use intrinsics. This allows reconsidering bpo-29782.

* Move the function to the new header.
* Changed return type to match __builtin_clzl and reviewed usage.
* Use intrinsics where available.
* Pick a (mostly theoretical) fallback implementation suitable for
  inlining.
vstinner pushed a commit that referenced this pull request Jun 15, 2020
In GH-2866, _Py_Bit_Length() was added to pymath.h for lack of a better
location. GH-20518 added a more appropriate header file for bit utilities. It
also shows how to properly use intrinsics. This allows reconsidering bpo-29782.

* Move the function to the new header.
* Changed return type to match __builtin_clzl() and reviewed usage.
* Use intrinsics where available.
* Pick a fallback implementation suitable for inlining.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants