From 16e04ceeddfdfad18fb1ae8530695a318fa9bc02 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com~> Date: Sun, 3 Sep 2023 23:17:27 +0200 Subject: [PATCH] fixup! Remove limb_width32 and limb_width64 features --- src/lexical/math.rs | 28 ++++++++++++++++++++++++---- tests/lexical/math.rs | 14 ++++++++++++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/lexical/math.rs b/src/lexical/math.rs index 9a2792b18..3c0ea0c34 100644 --- a/src/lexical/math.rs +++ b/src/lexical/math.rs @@ -67,9 +67,19 @@ impl LimbConfig for LimbConfig64 { const LARGE_POWERS: &'static [&'static [Self::Limb]] = &super::large_powers64::POW5; } -#[cfg(any(target_arch = "aarch64", target_arch = "mips64", target_arch = "powerpc64", target_arch = x86_64))] +#[cfg(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +))] type PlatformLimbConfig = LimbConfig64; -#[cfg(not(any(target_arch = "aarch64", target_arch = "mips64", target_arch = "powerpc64", target_arch = x86_64)))] +#[cfg(not(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +)))] type PlatformLimbConfig = LimbConfig32; pub type Limb = ::Limb; @@ -95,14 +105,24 @@ fn as_wide(t: T) -> Wide { /// Split u64 into limbs, in little-endian order. #[inline] -#[cfg(limb_width_32)] +#[cfg(not(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +)))] fn split_u64(x: u64) -> [Limb; 2] { [as_limb(x), as_limb(x >> 32)] } /// Split u64 into limbs, in little-endian order. #[inline] -#[cfg(limb_width_64)] +#[cfg(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +))] fn split_u64(x: u64) -> [Limb; 1] { [as_limb(x)] } diff --git a/tests/lexical/math.rs b/tests/lexical/math.rs index 79d3ef3ee..ce8ae502d 100644 --- a/tests/lexical/math.rs +++ b/tests/lexical/math.rs @@ -18,12 +18,22 @@ impl Math for Bigint { } } -#[cfg(limb_width_32)] +#[cfg(not(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +)))] pub(crate) fn from_u32(x: &[u32]) -> Vec { x.iter().cloned().collect() } -#[cfg(limb_width_64)] +#[cfg(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +))] pub(crate) fn from_u32(x: &[u32]) -> Vec { let mut v = Vec::::default(); for xi in x.chunks(2) {