#range #bit #extract #register #ic #bitrange

no-std simple-bitrange

A simple crate for manipulating bit ranges which is common when working with IC registers

1 unstable release

0.1.3 Jul 22, 2020
0.1.2 Jul 22, 2020
0.1.1 Jul 21, 2020
0.1.0 Jul 20, 2020

#2289 in Data structures

48 downloads per month

MIT/Apache

12KB
197 lines

simple-bitrange

Simple manipulation of bit ranges.

Documentation

Change log

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

A simple bit range crate

This crate aims to facilitate the extraction of bits in a small, simple crate. While it does not have as many bells and whistle as many other crates, simplicity is the key here.

Usage examples

Extract bits from slice of bytes:

let y: u32 = 0b00001111_11110000_01010000_00001010;
let p: &[u8] = &y.to_le_bytes();
let ret: u32 = p.range_read_le(..);

assert_eq!(ret, y);

No runtime deps

Features