Skip to content

Commit c70093b

Browse files
committed
remove unnecessary shift
1 parent 3605ad3 commit c70093b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

coresimd/x86/cpuid.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub unsafe fn __cpuid(leaf: u32) -> CpuidResult {
7878
}
7979

8080
/// Does the host support the `cpuid` instruction?
81-
#[inline(never)]
81+
#[inline]
8282
pub fn has_cpuid() -> bool {
8383
#[cfg(target_arch = "x86_64")]
8484
{
@@ -116,14 +116,15 @@ pub fn has_cpuid() -> bool {
116116
# otherwise. All other bits have not been modified and
117117
# are zero:
118118
xor $0, $1
119-
# Store in $0 the value of the 21st bit
120-
shr $0, 21
121119
"#
122120
: "=r"(result), "=r"(_temp)
123121
:
124122
: "cc", "memory"
125123
: "intel");
126124
}
125+
// Therefore, if result is 0, the bit was not modified and cpuid is
126+
// not available. If cpuid is available, the bit was modified and
127+
// result != 0.
127128
result != 0
128129
}
129130
}

0 commit comments

Comments
 (0)