Skip to content

Commit ea33053

Browse files
committed
Apply temporary unord fix from @beetrees rust-lang#593
1 parent 7df1d02 commit ea33053

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ mod c {
463463

464464
if (target_arch == "aarch64" || target_arch == "arm64ec") && consider_float_intrinsics {
465465
sources.extend(&[
466-
("__comparetf2", "comparetf2.c"),
467466
("__extenddftf2", "extenddftf2.c"),
468467
("__extendsftf2", "extendsftf2.c"),
469468
("__fixtfdi", "fixtfdi.c"),

src/float/mod.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,20 @@ macro_rules! float_impl {
127127
self.to_bits() as Self::SignedInt
128128
}
129129
fn eq_repr(self, rhs: Self) -> bool {
130-
if self.is_nan() && rhs.is_nan() {
130+
#[cfg(feature = "mangled-names")]
131+
fn is_nan(x: $ty) -> bool {
132+
// When using mangled-names, the "real" compiler-builtins might not have the
133+
// necessary builtin (__unordtf2) to test whether `f128` is NaN.
134+
// FIXME: Remove once the nightly toolchain has the __unordtf2 builtin
135+
// x is NaN if all the bits of the exponent are set and the significand is non-0
136+
x.repr() & $ty::EXPONENT_MASK == $ty::EXPONENT_MASK
137+
&& x.repr() & $ty::SIGNIFICAND_MASK != 0
138+
}
139+
#[cfg(not(feature = "mangled-names"))]
140+
fn is_nan(x: $ty) -> bool {
141+
x.is_nan()
142+
}
143+
if is_nan(self) && is_nan(rhs) {
131144
true
132145
} else {
133146
self.repr() == rhs.repr()

src/int/big.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const WORD_FULL_MASK: u64 = 0xffffffffffffffff;
1111
const U128_LO_MASK: u128 = u64::MAX as u128;
1212
const U128_HI_MASK: u128 = (u64::MAX as u128) << 64;
1313

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

35-
// Stored little endian
37+
/// A 256-bit signed integer represented as 4 64-bit limbs.
38+
///
39+
/// Each limb is a native-endian number, but the array is little-limb-endian.
3640
#[allow(non_camel_case_types)]
3741
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
3842
pub struct i256(pub [u64; 4]);

src/int/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pub mod sdiv;
1010
pub mod shift;
1111
pub mod udiv;
1212

13-
pub use leading_zeros::__clzsi2;
1413
pub use big::{i256, u256};
14+
pub use leading_zeros::__clzsi2;
1515

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

0 commit comments

Comments
 (0)