include!("common.rs");
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
mod ffi {
sys_type!({
pub(crate) type [Win32::System::Threading] PROCESSOR_FEATURE_ID = u32;
pub(crate) type [core] BOOL = i32;
});
sys_const!({
pub(crate) const [Win32::Foundation] FALSE: BOOL = 0;
pub(crate) const [Win32::System::Threading]
PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE: PROCESSOR_FEATURE_ID = 34;
#[cfg(test)]
pub(crate) const [Win32::System::Threading]
PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE: PROCESSOR_FEATURE_ID = 45;
});
sys_fn!({
extern "system" {
pub(crate) fn [Win32::System::Threading] IsProcessorFeaturePresent(
ProcessorFeature: PROCESSOR_FEATURE_ID,
) -> BOOL;
}
});
}
#[cold]
fn _detect(info: &mut CpuInfo) {
macro_rules! check {
($flag:ident, $bit:ident) => {
if unsafe { ffi::IsProcessorFeaturePresent(ffi::$bit) != ffi::FALSE } {
info.set(CpuInfoFlag::$flag);
}
};
}
check!(lse, PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE);
#[cfg(test)]
check!(rcpc, PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE);
}