Skip to content

Commit

Permalink
Merge pull request #1911 from multiversx/multi-esdt-opt
Browse files Browse the repository at this point in the history
removed unnecessary bounds check in to_array_of_refs/multi_esdt
  • Loading branch information
andrei-marinica authored Jan 6, 2025
2 parents eb91cb0 + b823eb4 commit f24601d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion framework/base/src/types/managed/wrapped/managed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ where
unsafe { MaybeUninit::<[MaybeUninit<T::Ref<'_>>; N]>::uninit().assume_init() };

for (index, value) in self.iter().enumerate() {
result_uninit[index].write(value);
// length already checked
unsafe {
result_uninit.get_unchecked_mut(index).write(value);
}
}

let result = unsafe { transmute_copy(&ManuallyDrop::new(result_uninit)) };
Expand Down

0 comments on commit f24601d

Please sign in to comment.