https://github.com/randymcmillan/count_set_bits
https://github.com/randymcmillan/count_set_bits
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/randymcmillan/count_set_bits
- Owner: RandyMcMillan
- License: mit
- Created: 2024-06-12T17:46:47.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-06-15T12:35:25.000Z (11 months ago)
- Last Synced: 2025-05-01T06:52:02.888Z (18 days ago)
- Language: Rust
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# count\_set\_bits [](https://github.com/RandyMcMillan/count_set_bits/actions/workflows/release.yml) [](https://github.com/RandyMcMillan/count_set_bits/actions/workflows/rust.yml)
```
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);
}
```