MCPcopy Index your code
hub / github.com/RustPython/RustPython / bit_count

Method bit_count

crates/vm/src/builtins/int.rs:624–626  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

622
623 #[pymethod]
624 fn bit_count(&self) -> u32 {
625 self.value.iter_u32_digits().map(|n| n.count_ones()).sum()
626 }
627
628 #[pymethod]
629 fn __getnewargs__(&self, vm: &VirtualMachine) -> PyObjectRef {

Callers 7

__len__Method · 0.80
test_huge_lshiftMethod · 0.80
test_bit_countMethod · 0.80
test_isqrt_hugeMethod · 0.80
test_union_bitfieldMethod · 0.80

Calls 2

sumMethod · 0.45
mapMethod · 0.45

Tested by 5

test_huge_lshiftMethod · 0.64
test_bit_countMethod · 0.64
test_isqrt_hugeMethod · 0.64
test_union_bitfieldMethod · 0.64