crate::ix!();
impl u160 {
#[inline]
pub fn from_le_bytes(mut bytes: [u8; 20]) -> Self {
tracing::trace!(
"u160::from_le_bytes ⇒ {:02X?}",
bytes
);
bytes.reverse();
Self::from_bytes_20(bytes)
}
}
#[cfg(test)]
mod u160_from_le_bytes_spec {
use super::*;
#[traced_test]
fn round_trip_le_bytes() {
info!("Verifying u160::from_le_bytes → as_slice() round‑trip.");
let original: [u8; 20] = [
0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0A,
0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14,
];
let value = u160::from_le_bytes(original);
trace!("Constructed value: {}", value.to_string());
assert_eq!(
value.as_slice(),
&original,
"Little‑endian bytes must be stored verbatim"
);
}
}