mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 21:13:44 +02:00
Remove unused and possibly unsafe code in memory.rs
This commit is contained in:
parent
a22bf51b7c
commit
a5dfa45797
1 changed files with 0 additions and 9 deletions
|
@ -73,12 +73,3 @@ pub fn to_byte_array<T: Copy, const S: usize>(o: T) -> [u8; S] {
|
|||
assert_eq!(S, size_of::<T>());
|
||||
unsafe { *(&o as *const T).cast() }
|
||||
}
|
||||
|
||||
/// Get a byte array as a flat object.
|
||||
///
|
||||
/// WARNING: while this is technically safe, care must be taken if the object requires aligned access.
|
||||
#[inline(always)]
|
||||
pub fn as_flat_object<T: Copy, const S: usize>(b: &[u8; S]) -> &T {
|
||||
assert!(std::mem::size_of::<T>() <= S);
|
||||
unsafe { &*b.as_ptr().cast() }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue