Redesign lib public interface
This commit is contained in:
parent
83bfa98a38
commit
61d875757d
7 changed files with 603 additions and 562 deletions
11
src/math.rs
Normal file
11
src/math.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
pub(crate) fn bitmask(n: u64) -> u64 {
|
||||
(1 << n) - 1
|
||||
}
|
||||
|
||||
pub(crate) fn next_sn_bits(field: u64, n: u32, offset: u32) -> u64 {
|
||||
(field >> offset) & ((1u64 << n) - 1)
|
||||
}
|
||||
|
||||
pub(crate) fn by_dword(n: &[u8]) -> u32 {
|
||||
(n[0] as u32) | (n[1] as u32) << 8 | (n[2] as u32) << 16 | (n[3] as u32) << 24
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue