#[cfg(target_arch = "aarch64")]
mod aarch64;
#[cfg(target_arch = "x86_64")]
mod x86_64;
#[cfg(target_arch = "aarch64")]
pub use aarch64::*;
pub use cpudetect_macros::target_family;
#[cfg(target_arch = "x86_64")]
pub use x86_64::*;
macro_rules! declare_is_compatible {
($family:literal $(, $feature:literal)* $(,)?) => {
pastey::paste! {
#[doc = concat!(
"Returns `true` if the current CPU is compatible with the `",
$family,
"` feature set."
)]
#[must_use]
#[inline(always)]
#[cfg(feature = "static")]
pub fn [<is_ $family _compatible>]() -> bool {
true $(&& [<has_ $feature>]())*
}
#[doc = concat!(
"Returns `true` if the current CPU is compatible with the `",
$family,
"` feature set."
)]
#[must_use]
#[inline]
#[cfg(not(feature = "static"))]
pub fn [<is_ $family _compatible>]() -> bool {
use std::sync::LazyLock;
#[allow(non_upper_case_globals)]
static [<lazy_ $family>]: LazyLock<bool> = LazyLock::new(|| {
true $(&& [<has_ $feature>]())*
});
*[<lazy_ $family>]
}
}
};
}
pub(crate) use declare_is_compatible;