GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||
GeezerVison is showing github.com — bpo-29782: Use __builtin_clzl for bits_in_digit if available by niklasf · Pull Request #594 · python/cpython Conversation
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
mdickinson
suggested changes
|
Ah, no. I see. This should work whenever |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
21c4a4b to
bff329a
Compare
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please rename the function to _Py_bit_length().
Why the result is signed? Why not unsigned int?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is the builtin available in old GCC versions? Any idea when the function was added?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
gcc 3.4. I made the guard more precise. It also works for clang.
Btw. while looking how this is usually done in Python I found a typo that would affect gcc 3.x: https://github.com/python/cpython/blob/master/Include/pymacro.h#L56 should say __GNU*C*_MINOR__. I'll make a seperate PR. #878.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
would it be possible to avoid the conditional code?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't think so. __builtin_clzl(0) is undefined or rather has different behavior on various processors.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we need the following pragma?
#pragma intrinsic(_BitScanReverse)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Haypo Thanks for the review. I updated the PR based on your comments. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
http://bugs.python.org/issue29782 has been closed as REJECTED. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.