hpt_common/utils/
simd_ref.rs1use std::marker::PhantomData;
2
3use crate::utils::pointer::Pointer;
4
5#[derive(Debug)]
7pub struct MutVec<'a, T> {
8 ptr: Pointer<T>,
9 _phantom: PhantomData<&'a mut T>,
10}
11
12impl<'a, T> MutVec<'a, T> {
13 #[inline(always)]
15 pub fn new(ptr: Pointer<T>) -> Self {
16 Self {
17 ptr,
18 _phantom: PhantomData,
19 }
20 }
21
22 #[inline(always)]
24 pub fn write_unaligned(&self, value: T) {
25 unsafe {
26 self.ptr.ptr.write_unaligned(value);
27 }
28 }
29
30 #[inline(always)]
31 pub fn read_unaligned(&self) -> T {
33 unsafe { self.ptr.ptr.read_unaligned() }
34 }
35}