Implement to native endian functions as a trait for u32/u64
This commit is contained in:
1 parent
6119408e1f
commit
62bd482acb
3 files changed
+31
-13
No files matched your search
@@ -21,14 +21,4 @@ impl Utils {
|
||||
let time = clock_gettime(ClockId::CLOCK_MONOTONIC)?;
|
||||
Ok((time.tv_sec() as f64, time.tv_nsec() as f64))
|
||||
}
|
||||
|
||||
#[cfg(target_endian = "big")]
|
||||
pub fn to_ne(val: u64) -> u64 {
|
||||
val.to_be()
|
||||
}
|
||||
|
||||
#[cfg(target_endian = "little")]
|
||||
pub fn to_ne(val: u32) -> u32 {
|
||||
val.to_le()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user