]>
Commit | Line | Data |
---|---|---|
532ac7d7 | 1 | use crate::ops::{Deref, DerefMut}; |
abe05a73 XL |
2 | |
3 | #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] | |
923072b8 FG |
4 | #[cfg_attr(target_arch = "aarch64", repr(align(128)))] |
5 | #[cfg_attr(not(target_arch = "aarch64"), repr(align(64)))] | |
3c0e092e | 6 | pub(super) struct CacheAligned<T>(pub T); |
abe05a73 XL |
7 | |
8 | impl<T> Deref for CacheAligned<T> { | |
60c5eb7d XL |
9 | type Target = T; |
10 | fn deref(&self) -> &Self::Target { | |
11 | &self.0 | |
12 | } | |
abe05a73 XL |
13 | } |
14 | ||
15 | impl<T> DerefMut for CacheAligned<T> { | |
60c5eb7d XL |
16 | fn deref_mut(&mut self) -> &mut Self::Target { |
17 | &mut self.0 | |
18 | } | |
abe05a73 XL |
19 | } |
20 | ||
21 | impl<T> CacheAligned<T> { | |
22 | pub(super) fn new(t: T) -> Self { | |
3c0e092e | 23 | CacheAligned(t) |
abe05a73 XL |
24 | } |
25 | } |