mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-29882: Add an efficient popcount method for integers (#771)
* bpo-29882: Add an efficient popcount method for integers * Update 'sign bit' and versionadded in docs * Add entry to whatsnew document * Doc: use positive example, mention population count * Minor cleanups of the core code * Move popcount_digit closer to where it's used * Use z instead of self after conversion * Add 'absolute value' and 'population count' to docstring * Fix clinic error about missing summary line * Ensure popcount_digit is portable with 64-bit ints Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
This commit is contained in:
parent
364b5ead15
commit
8bd216dfed
7 changed files with 135 additions and 2 deletions
|
@ -669,7 +669,7 @@ plain ol' Python and is guaranteed to be available.
|
|||
True
|
||||
>>> real_tests = [t for t in tests if len(t.examples) > 0]
|
||||
>>> len(real_tests) # objects that actually have doctests
|
||||
13
|
||||
14
|
||||
>>> for t in real_tests:
|
||||
... print('{} {}'.format(len(t.examples), t.name))
|
||||
...
|
||||
|
@ -682,6 +682,7 @@ plain ol' Python and is guaranteed to be available.
|
|||
1 builtins.hex
|
||||
1 builtins.int
|
||||
3 builtins.int.as_integer_ratio
|
||||
2 builtins.int.bit_count
|
||||
2 builtins.int.bit_length
|
||||
5 builtins.memoryview.hex
|
||||
1 builtins.oct
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue