11 releases
0.0.18 | Jun 15, 2024 |
---|---|
0.0.14 | Jun 15, 2024 |
#14 in #set-bit
11KB
180 lines
count_set_bits
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);
}