Start of data_to_text family

This commit is contained in:
2025-06-05 14:19:45 -04:00
parent 37cc9e4fdb
commit f93131622f
11 changed files with 320 additions and 73 deletions
+19 -2
View File
@@ -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
}
}