diff --git a/.github/workflows/Simple.yml b/.github/workflows/Simple.yml index 610e813..02f63af 100644 --- a/.github/workflows/Simple.yml +++ b/.github/workflows/Simple.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.31.0, 1.41.0, 1.51.0, stable, beta, nightly] + rust: [1.36.0, 1.41.0, 1.46.0, 1.51.0, stable, beta, nightly] steps: - uses: actions/checkout@v2 with: diff --git a/README.md b/README.md index e60ec24..b344bf5 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ minimal-lexical should also work on a wide variety of other architectures and IS # Minimum Version Support -Minimal-lexical is tested to support Rustc 1.31+, including stable, beta, and nightly. Please report any errors compiling a supported lexical version on a compatible Rustc version. +Minimal-lexical is tested to support Rustc 1.36+, including stable, beta, and nightly. Please report any errors compiling a supported lexical version on a compatible Rustc version. Please note we may increment the MSRV for compiler versions older than 18 months, to support at least the current Debian stable version, without breaking changes. # Changelog diff --git a/src/bellerophon.rs b/src/bellerophon.rs index 8966710..b5433f1 100644 --- a/src/bellerophon.rs +++ b/src/bellerophon.rs @@ -317,7 +317,8 @@ pub fn mul(x: &ExtendedFloat, y: &ExtendedFloat) -> ExtendedFloat { debug_assert!(y.mant >> 32 != 0); // Extract high-and-low masks. - const LOMASK: u64 = u32::MAX as u64; + // Mask is u32::MAX for older Rustc versions. + const LOMASK: u64 = 0xffff_ffff as u64; let x1 = x.mant >> 32; let x0 = x.mant & LOMASK; let y1 = y.mant >> 32; @@ -363,7 +364,7 @@ pub struct BellerophonPowers { /// Allow indexing of values without bounds checking impl BellerophonPowers { #[inline] - pub const fn get_small(&self, index: usize) -> ExtendedFloat { + pub fn get_small(&self, index: usize) -> ExtendedFloat { let mant = self.small[index]; let exp = (1 - 64) + ((self.log2 * index as i64) >> self.log2_shift); ExtendedFloat { @@ -373,7 +374,7 @@ impl BellerophonPowers { } #[inline] - pub const fn get_large(&self, index: usize) -> ExtendedFloat { + pub fn get_large(&self, index: usize) -> ExtendedFloat { let mant = self.large[index]; let biased_e = index as i64 * self.step as i64 - self.bias as i64; let exp = (1 - 64) + ((self.log2 * biased_e) >> self.log2_shift); @@ -384,7 +385,7 @@ impl BellerophonPowers { } #[inline] - pub const fn get_small_int(&self, index: usize) -> u64 { + pub fn get_small_int(&self, index: usize) -> u64 { self.small_int[index] } } diff --git a/src/mask.rs b/src/mask.rs index 577ad08..1957c8b 100644 --- a/src/mask.rs +++ b/src/mask.rs @@ -17,7 +17,8 @@ pub fn lower_n_mask(n: u64) -> u64 { debug_assert!(n <= 64, "lower_n_mask() overflow in shl."); match n == 64 { - true => u64::MAX, + // u64::MAX for older Rustc versions. + true => 0xffff_ffff_ffff_ffff, false => (1 << n) - 1, } } diff --git a/src/num.rs b/src/num.rs index 1608a13..7e10ee2 100644 --- a/src/num.rs +++ b/src/num.rs @@ -84,7 +84,8 @@ pub trait Float: const CARRY_MASK: u64; /// Bias for marking an invalid extended float. - const INVALID_FP: i32 = i16::MIN as i32; + // Value is `i16::MIN`, using hard-coded constants for older Rustc versions. + const INVALID_FP: i32 = -0x8000; // Maximum mantissa for the fast-path (`1 << 53` for f64). const MAX_MANTISSA_FAST_PATH: u64 = 2_u64 << Self::MANTISSA_SIZE; @@ -163,7 +164,7 @@ pub trait Float: }; #[cfg(feature = "compact")] - return (radix as u64).wrapping_pow(exponent as u32); + return (radix as u64).pow(exponent as u32); } /// Returns true if the float is a denormal. @@ -270,7 +271,8 @@ impl Float for f32 { #[inline] fn from_bits(u: u64) -> f32 { - debug_assert!(u <= u32::MAX as u64); + // Constant is `u32::MAX` for older Rustc versions. + debug_assert!(u <= 0xffff_ffff); f32::from_bits(u as u32) } diff --git a/src/stackvec.rs b/src/stackvec.rs index 06071eb..23a1146 100644 --- a/src/stackvec.rs +++ b/src/stackvec.rs @@ -45,7 +45,8 @@ impl StackVec { /// Safe as long as `len` is less than `BIGINT_LIMBS`. #[inline] pub unsafe fn set_len(&mut self, len: usize) { - debug_assert!(len <= u16::MAX as usize); + // Constant is `u16::MAX` for older Rustc versions. + debug_assert!(len <= 0xffff); debug_assert!(len <= bigint::BIGINT_LIMBS); self.length = len as u16; }