Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov authored Oct 16, 2024
1 parent 5ea3724 commit 2c9ff4f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ pub(super) unsafe fn split_init(
buf: &mut [MaybeUninit<u8>],
init_len: usize,
) -> (&mut [u8], &mut [MaybeUninit<u8>]) {
debug_assert!(buf.len() <= init);
let uninit_len = buf.len().unchecked_sub(init_len);
debug_assert!(buf.len() <= init_len);
let buf_ptr = buf.as_mut_ptr();
let uninit_len = buf.len() - init_len;
let init = slice::from_raw_parts_mut(buf_ptr.cast::<u8>(), init_len);
let uninit = slice::from_raw_parts_mut(buf_ptr.add(init_len), uninit_len);
(init, uninit)
Expand Down

0 comments on commit 2c9ff4f

Please sign in to comment.