2023-10-15 18:06:20 +02:00
|
|
|
pub fn as_u32_be(array: &[u8]) -> u32 {
|
|
|
|
((array[0] as u32) << 24)
|
|
|
|
+ ((array[1] as u32) << 16)
|
|
|
|
+ ((array[2] as u32) << 8)
|
|
|
|
+ ((array[3] as u32) << 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn as_u64_be(array: &[u8]) -> u64 {
|
|
|
|
((array[0] as u64) << 56)
|
|
|
|
+ ((array[1] as u64) << 48)
|
|
|
|
+ ((array[2] as u64) << 40)
|
|
|
|
+ ((array[3] as u64) << 32)
|
|
|
|
+ ((array[4] as u64) << 24)
|
|
|
|
+ ((array[5] as u64) << 16)
|
|
|
|
+ ((array[6] as u64) << 8)
|
|
|
|
+ ((array[7] as u64) << 0)
|
|
|
|
}
|
2023-10-15 18:06:33 +02:00
|
|
|
|
|
|
|
macro_rules! impl_into_enum_variant {
|
|
|
|
($houser: tt::$variant: tt, $impl_type: ty) => {
|
|
|
|
impl Into<$houser> for $impl_type {
|
|
|
|
fn into(self) -> $houser {
|
|
|
|
$houser::$variant(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|