mirror of
https://gitlab.com/artofrev/smallint.git
synced 2024-12-04 17:11:38 -05:00
Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
commit
0347b1f6d2
|
@ -48,10 +48,8 @@ impl Drop for SmallInt {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Self::Heap((r, s)) = self {
|
if let Self::Heap((r, s)) = self {
|
||||||
let size = usize::try_from(s.abs()).unwrap();
|
let size = usize::try_from(s.abs()).unwrap();
|
||||||
let mut slice = unsafe { core::slice::from_raw_parts(r, size) };
|
let slice = unsafe { core::slice::from_raw_parts_mut(*r, size) };
|
||||||
unsafe {
|
unsafe { std::mem::drop(Box::from_raw(slice)) }
|
||||||
core::ptr::drop_in_place(&mut slice);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +98,7 @@ impl From<u128> for SmallInt {
|
||||||
while v != 0 {
|
while v != 0 {
|
||||||
vec.push(v as u32);
|
vec.push(v as u32);
|
||||||
|
|
||||||
v = (v >> 1) >> (32 - 1);
|
v >>= 32;
|
||||||
}
|
}
|
||||||
let mut slice = ManuallyDrop::new(vec.into_boxed_slice());
|
let mut slice = ManuallyDrop::new(vec.into_boxed_slice());
|
||||||
SmallInt::Heap((slice.as_mut_ptr(), isize::try_from(slice.len()).unwrap()))
|
SmallInt::Heap((slice.as_mut_ptr(), isize::try_from(slice.len()).unwrap()))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user