-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cbb01b
commit 4f57286
Showing
4 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#[macro_use] | ||
mod safe_getters; | ||
mod utils; | ||
|
||
pub mod counter; | ||
pub use counter::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// Pads and aligns a value to the length of a cache line. | ||
/// Code borrowed from https://github.com/ibraheemdev/seize/blob/master/src/utils.rs | ||
#[cfg_attr( | ||
any( | ||
target_arch = "x86_64", | ||
target_arch = "aarch64", | ||
target_arch = "powerpc64", | ||
), | ||
repr(align(128)) | ||
)] | ||
#[cfg_attr( | ||
any( | ||
target_arch = "arm", | ||
target_arch = "mips", | ||
target_arch = "mips64", | ||
target_arch = "riscv64", | ||
), | ||
repr(align(32)) | ||
)] | ||
#[cfg_attr(target_arch = "s390x", repr(align(256)))] | ||
#[cfg_attr( | ||
not(any( | ||
target_arch = "x86_64", | ||
target_arch = "aarch64", | ||
target_arch = "powerpc64", | ||
target_arch = "arm", | ||
target_arch = "mips", | ||
target_arch = "mips64", | ||
target_arch = "riscv64", | ||
target_arch = "s390x", | ||
)), | ||
repr(align(64)) | ||
)] | ||
pub struct CachePadded<T> { | ||
pub value: T, | ||
} |