We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
CacheAligned
1 parent 9982ad9 commit 46bb382Copy full SHA for 46bb382
rust/lib.rs
@@ -66,6 +66,12 @@ pub const DEFAULT_ALIGNMENT: usize = 128;
66
#[derive(Clone, Copy, Debug, Default)]
67
pub struct CacheAligned<T>(pub T);
68
69
+// Compile-time assertion that alignment matches DEFAULT_ALIGNMENT
70
+const _: () = assert!(
71
+ core::mem::align_of::<CacheAligned<u8>>() == DEFAULT_ALIGNMENT,
72
+ "CacheAligned alignment must match DEFAULT_ALIGNMENT"
73
+);
74
+
75
/// A generic spin mutex that uses CPU-specific pause instructions for efficient busy-waiting.
76
///
77
/// This is a low-level synchronization primitive that spins on a busy loop rather than
0 commit comments