11 releases
0.0.18 | Jun 15, 2024 |
---|---|
0.0.14 | Jun 15, 2024 |
#14 in #set-bit
305 downloads per month
11KB
180 lines
count_set_bits
![Rust](https://img.gs/czjpqfbdkz/full/https://github.com/RandyMcMillan/count_set_bits/actions/workflows/rust.yml/badge.svg)
cargo add count_set_bits
main example
use count_set_bits::count_set_bits;
fn main() {
let num = 13; // Example usage, change x as needed
let set_bits = count_set_bits(num.try_into().unwrap(), true);
println!("\nNumber of set bits in {}: {}", num, set_bits);
}