Start of data_to_text family
This commit is contained in:
@@ -94,7 +94,24 @@ impl NumberSystemConversion {
|
||||
(high as u16) << 8 | low as u16
|
||||
}
|
||||
|
||||
pub fn join_bytes_u16_from_u8(high: u8, low: u8) -> u16 {
|
||||
low as u16 | ((high as u16) << 8)
|
||||
|
||||
/// clear_high_bits
|
||||
///
|
||||
/// Clear the 8 MSB of the value
|
||||
///
|
||||
/// ex: 0xffff -> 0x00ff
|
||||
/// 0xabcd -> 0x00cd
|
||||
pub fn clear_high_bits(to_clear: u16) -> u16 {
|
||||
to_clear & 0x00ff
|
||||
}
|
||||
|
||||
/// clear_low_bits
|
||||
///
|
||||
/// Clear the 8 LSB of the value
|
||||
///
|
||||
/// ex: 0xffff -> 0xff00
|
||||
/// 0xabcd -> 0xab00
|
||||
pub fn clear_low_bits(to_clear: u16) -> u16 {
|
||||
to_clear & 0xff00
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user