Skip to content

Commit

Permalink
Apply temporary unord fix from @beetrees rust-lang#593
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Apr 17, 2024
1 parent b30cdd1 commit a2c94d0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ mod c {

if (target_arch == "aarch64" || target_arch == "arm64ec") && consider_float_intrinsics {
sources.extend(&[
("__comparetf2", "comparetf2.c"),
("__extenddftf2", "extenddftf2.c"),
("__extendsftf2", "extendsftf2.c"),
("__fixtfdi", "fixtfdi.c"),
Expand Down
15 changes: 14 additions & 1 deletion src/float/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,20 @@ macro_rules! float_impl {
self.to_bits() as Self::SignedInt
}
fn eq_repr(self, rhs: Self) -> bool {
if self.is_nan() && rhs.is_nan() {
#[cfg(feature = "mangled-names")]
fn is_nan(x: $ty) -> bool {
// When using mangled-names, the "real" compiler-builtins might not have the
// necessary builtin (__unordtf2) to test whether `f128` is NaN.
// FIXME: Remove once the nightly toolchain has the __unordtf2 builtin
// x is NaN if all the bits of the exponent are set and the significand is non-0
x.repr() & $ty::EXPONENT_MASK == $ty::EXPONENT_MASK
&& x.repr() & $ty::SIGNIFICAND_MASK != 0
}
#[cfg(not(feature = "mangled-names"))]
fn is_nan(x: $ty) -> bool {
x.is_nan()
}
if is_nan(self) && is_nan(rhs) {
true
} else {
self.repr() == rhs.repr()
Expand Down
8 changes: 6 additions & 2 deletions src/int/big.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const WORD_FULL_MASK: u64 = 0xffffffffffffffff;
const U128_LO_MASK: u128 = u64::MAX as u128;
const U128_HI_MASK: u128 = (u64::MAX as u128) << 64;

// Stored little endian
/// A 256-bit unsigned integer represented as 4 64-bit limbs.
///
/// Each limb is a native-endian number, but the array is little-limb-endian.
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct u256(pub [u64; 4]);
Expand All @@ -32,7 +34,9 @@ impl i256 {
}
}

// Stored little endian
/// A 256-bit signed integer represented as 4 64-bit limbs.
///
/// Each limb is a native-endian number, but the array is little-limb-endian.
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct i256(pub [u64; 4]);
Expand Down
2 changes: 1 addition & 1 deletion src/int/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pub mod sdiv;
pub mod shift;
pub mod udiv;

pub use leading_zeros::__clzsi2;
pub use big::{i256, u256};
pub use leading_zeros::__clzsi2;

public_test_dep! {
/// Minimal integer implementations needed on all integer types, including wide integers.
Expand Down

0 comments on commit a2c94d0

Please sign in to comment.