summaryrefslogtreecommitdiffstats
path: root/library/stdarch/crates/core_arch/src/x86_64/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/stdarch/crates/core_arch/src/x86_64/macros.rs')
-rw-r--r--library/stdarch/crates/core_arch/src/x86_64/macros.rs28
1 files changed, 7 insertions, 21 deletions
diff --git a/library/stdarch/crates/core_arch/src/x86_64/macros.rs b/library/stdarch/crates/core_arch/src/x86_64/macros.rs
index a3ea0e821..17e1c257c 100644
--- a/library/stdarch/crates/core_arch/src/x86_64/macros.rs
+++ b/library/stdarch/crates/core_arch/src/x86_64/macros.rs
@@ -1,36 +1,22 @@
//! Utility macros.
-// Helper struct used to trigger const eval errors when the const generic immediate value `imm` is
+// Helper macro used to trigger const eval errors when the const generic immediate value `imm` is
// not a round number.
-pub(crate) struct ValidateConstRound<const IMM: i32>;
-impl<const IMM: i32> ValidateConstRound<IMM> {
- pub(crate) const VALID: () = {
- assert!(
- IMM == 4 || IMM == 8 || IMM == 9 || IMM == 10 || IMM == 11,
- "Invalid IMM value"
- );
- };
-}
-
#[allow(unused)]
macro_rules! static_assert_rounding {
($imm:ident) => {
- let _ = $crate::core_arch::x86_64::macros::ValidateConstRound::<$imm>::VALID;
+ static_assert!(
+ $imm == 4 || $imm == 8 || $imm == 9 || $imm == 10 || $imm == 11,
+ "Invalid IMM value"
+ )
};
}
-// Helper struct used to trigger const eval errors when the const generic immediate value `imm` is
+// Helper macro used to trigger const eval errors when the const generic immediate value `imm` is
// not a sae number.
-pub(crate) struct ValidateConstSae<const IMM: i32>;
-impl<const IMM: i32> ValidateConstSae<IMM> {
- pub(crate) const VALID: () = {
- assert!(IMM == 4 || IMM == 8, "Invalid IMM value");
- };
-}
-
#[allow(unused)]
macro_rules! static_assert_sae {
($imm:ident) => {
- let _ = $crate::core_arch::x86_64::macros::ValidateConstSae::<$imm>::VALID;
+ static_assert!($imm == 4 || $imm == 8, "Invalid IMM value")
};
}