Skip to content

Commit

Permalink
Added #[cfg(target_arch = x86_64)] to f16 and f128
Browse files Browse the repository at this point in the history
  • Loading branch information
rezwanahmedsami committed Aug 18, 2024
1 parent 803cbaf commit 9f39427
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/ui/consts/const-float-bits-conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fn has_broken_floats() -> bool {
std::env::var("TARGET").is_ok_and(|v| v.contains("i586"))
}

#[cfg(target_arch = "x86_64")]
fn f16(){
const_assert!((1f16).to_bits(), 0x3c00);
const_assert!(u16::from_be_bytes(1f16.to_be_bytes()), 0x3c00);
Expand Down Expand Up @@ -119,6 +120,7 @@ fn f64() {
}
}

#[cfg(target_arch = "x86_64")]
fn f128() {
const_assert!((1f128).to_bits(), 0x3fff0000000000000000000000000000);
const_assert!(u128::from_be_bytes(1f128.to_be_bytes()), 0x3fff0000000000000000000000000000);
Expand Down Expand Up @@ -150,8 +152,11 @@ fn f128() {
}

fn main() {
f16();
#[cfg(target_arch = "x86_64")]
{
f16();
f128();
}
f32();
f64();
f128();
}

0 comments on commit 9f39427

Please sign in to comment.