diff options
Diffstat (limited to 'doc/release/upcoming_changes')
-rw-r--r-- | doc/release/upcoming_changes/19355.new_feature.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/19355.new_feature.rst b/doc/release/upcoming_changes/19355.new_feature.rst new file mode 100644 index 000000000..cfa50b7a1 --- /dev/null +++ b/doc/release/upcoming_changes/19355.new_feature.rst @@ -0,0 +1,13 @@ +``bit_count`` to compute the number of 1-bits in an integer +----------------------------------------------------------- + +Computes the number of 1-bits in the absolute value of the input. +This works on all the numpy integer types. Analogous to the builtin +``int.bit_count`` or ``popcount`` in C++. + +.. code-block:: python + + >>> np.uint32(1023).bit_count() + 10 + >>> np.int32(-127).bit_count() + 7 |