Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
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_lshift
Method · 0.80
test_huge_rshift_of_huge
Method · 0.80
test_bit_count
Method · 0.80
test_isqrt_huge
Method · 0.80
_check_struct_or_union
Method · 0.80
test_union_bitfield
Method · 0.80
Calls
2
sum
Method · 0.45
map
Method · 0.45
Tested by
5
test_huge_lshift
Method · 0.64
test_huge_rshift_of_huge
Method · 0.64
test_bit_count
Method · 0.64
test_isqrt_huge
Method · 0.64
test_union_bitfield
Method · 0.64