#bit #integer #bit-flags #flags #mask

bitops

Miscellaneous bit operations for any Integer

1 unstable release

Uses old Rust 2015

0.1.0 Jun 27, 2018

#11 in #flag

Download history 49/week @ 2024-11-15 81/week @ 2024-11-22 130/week @ 2024-11-29 93/week @ 2024-12-06 134/week @ 2024-12-13 44/week @ 2024-12-20 30/week @ 2024-12-27 87/week @ 2025-01-03 158/week @ 2025-01-10 181/week @ 2025-01-17 151/week @ 2025-01-24 240/week @ 2025-01-31 172/week @ 2025-02-07 100/week @ 2025-02-14 105/week @ 2025-02-21 131/week @ 2025-02-28

534 downloads per month
Used in 2 crates (via radiotap)

Apache-2.0/MIT

7KB

bitops

crates.io docs.rs

Miscellaneous bit operations for any Integer. See documentation here.

Getting started

Add to your project with

cargo add bitops

or directly editing your Cargo.toml

[dependencies]
bitops = "0.1.0"

Example usage

use bitops::BitOps;

let x = 0b1010_1011_0000_1100; // 0xab0c
let flag = 0b1000;

assert!(flag.is_flag());
assert!(flag.is_bit_set(3));

assert!(x.is_flag_set(flag));
assert_eq!(x.bits_as_int(8, 4), 0xb);

License

Licensed under either of

at your option.


lib.rs:

Miscellaneous bit operations for any Integer.

See the BitOps trait for examples.

Dependencies

~205KB