def _popcnt(a: int) -> int:
    """Returns the Hamming weight of the given non-negative integer."""
    t = 0
    while a > 0:
        a &= a - 1
        t += 1
    return t
Returns the Hamming weight of the given non-negative integer.
cirq-core/cirq/interop/quirk/cells/arithmetic_cells.py