summaryrefslogtreecommitdiff
path: root/doc/release/upcoming_changes/19355.new_feature.rst
blob: cfa50b7a175c3d131082828a5d20f07be87d5c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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