From 08e954cef1c55a153b21df3d6bb9ba60715476f9 Mon Sep 17 00:00:00 2001 From: Jose Mendoza <56417208+StunxFS@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:11:37 +0000 Subject: [PATCH] simplify boxed_reisze --- lib/core/src/mem/Boxedptr.c.ri | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/core/src/mem/Boxedptr.c.ri b/lib/core/src/mem/Boxedptr.c.ri index 07ca70598..846c5b825 100644 --- a/lib/core/src/mem/Boxedptr.c.ri +++ b/lib/core/src/mem/Boxedptr.c.ri @@ -34,12 +34,10 @@ pub func boxed_zeroed(size: uint, dtor: ?BoxedptrDestroy := none) -> boxedptr { } pub func boxed_resize(ptr: boxedptr, size: uint) -> boxedptr { - old_boxed := Boxedptr.from_boxedptr(ptr); new_boxed := unsafe { - @as(&mut Boxedptr, raw_resize(old_boxed, BOXEDPTR_SIZE + size)) - }; - new_boxed.value = unsafe { - @as(boxedptr, @ptr_add(@as([&]uint8, new_boxed), BOXEDPTR_SIZE)) + @as( + &mut Boxedptr, raw_resize(Boxedptr.from_boxedptr(ptr), BOXEDPTR_SIZE + size) + ) }; return new_boxed.value; }