Skip to content

Commit 66ffdef

Browse files
author
The rustc-josh-sync Cronjob Bot
committed
Merge ref '23d01cd24125' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 23d01cd2412583491621ab1ca4f1b01e37d11e39 Filtered ref: 5d28c73 Upstream diff: rust-lang/rust@2dc3024...23d01cd This merge was created using https://github.com/rust-lang/josh-sync.
2 parents be448ff + 5d28c73 commit 66ffdef

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

libm/src/math/arch/x86/detect.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn load_x86_features() -> Flags {
5757
// (in that order)
5858
let mut vendor_id = [0u8; 12];
5959
let max_basic_leaf;
60-
unsafe {
60+
{
6161
let CpuidResult { eax, ebx, ecx, edx } = __cpuid(0);
6262
max_basic_leaf = eax;
6363
vendor_id[0..4].copy_from_slice(&ebx.to_ne_bytes());
@@ -72,7 +72,7 @@ fn load_x86_features() -> Flags {
7272

7373
// EAX = 1, ECX = 0: Queries "Processor Info and Feature Bits";
7474
// Contains information about most x86 features.
75-
let CpuidResult { ecx, edx, .. } = unsafe { __cpuid(0x0000_0001_u32) };
75+
let CpuidResult { ecx, edx, .. } = __cpuid(0x0000_0001_u32);
7676
let proc_info_ecx = Flags::from_bits(ecx);
7777
let proc_info_edx = Flags::from_bits(edx);
7878

@@ -82,23 +82,23 @@ fn load_x86_features() -> Flags {
8282
let mut extended_features_edx = Flags::empty();
8383
let mut extended_features_eax_leaf_1 = Flags::empty();
8484
if max_basic_leaf >= 7 {
85-
let CpuidResult { ebx, edx, .. } = unsafe { __cpuid(0x0000_0007_u32) };
85+
let CpuidResult { ebx, edx, .. } = __cpuid(0x0000_0007_u32);
8686
extended_features_ebx = Flags::from_bits(ebx);
8787
extended_features_edx = Flags::from_bits(edx);
8888

89-
let CpuidResult { eax, .. } = unsafe { __cpuid_count(0x0000_0007_u32, 0x0000_0001_u32) };
89+
let CpuidResult { eax, .. } = __cpuid_count(0x0000_0007_u32, 0x0000_0001_u32);
9090
extended_features_eax_leaf_1 = Flags::from_bits(eax)
9191
}
9292

9393
// EAX = 0x8000_0000, ECX = 0: Get Highest Extended Function Supported
9494
// - EAX returns the max leaf value for extended information, that is,
9595
// `cpuid` calls in range [0x8000_0000; u32::MAX]:
96-
let extended_max_basic_leaf = unsafe { __cpuid(0x8000_0000_u32) }.eax;
96+
let extended_max_basic_leaf = __cpuid(0x8000_0000_u32).eax;
9797

9898
// EAX = 0x8000_0001, ECX=0: Queries "Extended Processor Info and Feature Bits"
9999
let mut extended_proc_info_ecx = Flags::empty();
100100
if extended_max_basic_leaf >= 1 {
101-
let CpuidResult { ecx, .. } = unsafe { __cpuid(0x8000_0001_u32) };
101+
let CpuidResult { ecx, .. } = __cpuid(0x8000_0001_u32);
102102
extended_proc_info_ecx = Flags::from_bits(ecx);
103103
}
104104

0 commit comments

Comments
 (0)