mirror of
https://github.com/urbit/ares.git
synced 2024-12-23 21:31:57 +03:00
Fix minor unsafe blocks
This commit is contained in:
parent
1ae6303cbf
commit
44ba80cd33
@ -474,9 +474,9 @@ impl IndirectAtom {
|
||||
|
||||
pub unsafe fn as_u128_pair(self) -> Result<[u64; 2]> {
|
||||
if self.size() <= 2 {
|
||||
let mut u128_array = &mut [0u64; 2];
|
||||
let u128_array = &mut [0u64; 2];
|
||||
u128_array.copy_from_slice(&(self.as_slice()[0..2]));
|
||||
Ok(unsafe { *u128_array })
|
||||
Ok(*u128_array)
|
||||
} else {
|
||||
Err(Error::NotRepresentable)
|
||||
}
|
||||
@ -766,10 +766,10 @@ impl Atom {
|
||||
|
||||
pub unsafe fn as_u128_pair(self) -> Result<[u64; 2]> {
|
||||
if self.is_direct() {
|
||||
let mut u128_array = &mut [0u64; 2];
|
||||
u128_array[0] = 0x0 as u64;
|
||||
u128_array[1] = self.as_direct()?.data() as u64;
|
||||
Ok(unsafe { *u128_array })
|
||||
let u128_array = &mut [0u64; 2];
|
||||
u128_array[0] = 0x0_u64;
|
||||
u128_array[1] = self.as_direct()?.data();
|
||||
Ok(*u128_array)
|
||||
} else {
|
||||
unsafe { self.indirect.as_u128_pair() }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user