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.
1 parent 965d0f2 commit cb41dd1Copy full SHA for cb41dd1
coresimd/x86/cpuid.rs
@@ -96,7 +96,7 @@ pub fn has_cpuid() -> bool {
96
let eflags: u32 = __readeflags();
97
98
// Invert the ID bit in EFLAGS:
99
- let eflags_mod: u32 = eflags | 0x0020_0000;
+ let eflags_mod: u32 = eflags ^ 0x0020_0000;
100
101
// Store the modified EFLAGS (ID bit may or may not be inverted)
102
__writeeflags(eflags_mod);
@@ -138,6 +138,11 @@ mod tests {
138
assert!(cpuid::has_cpuid());
139
}
140
141
+ #[test]
142
+ fn test_has_cpuid_idempotent() {
143
+ assert_eq!(cpuid::has_cpuid(), cpuid::has_cpuid());
144
+ }
145
+
146
#[cfg(target_arch = "x86")]
147
#[test]
148
fn test_has_cpuid() {
0 commit comments