From 16e81e97d9747e4da7d68e38234cb9a0e62197e5 Mon Sep 17 00:00:00 2001 From: Amar Shah Date: Tue, 22 Sep 2026 22:49:09 -0700 Subject: [PATCH] Fix bignum build on 16-bit targets --- library/core/src/num/imp/bignum.rs | 6 +++--- library/core/src/num/imp/flt2dec/strategy/dragon.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/core/src/num/imp/bignum.rs b/library/core/src/num/imp/bignum.rs index 95046e96fc8f2..5c2a19f39dfce 100644 --- a/library/core/src/num/imp/bignum.rs +++ b/library/core/src/num/imp/bignum.rs @@ -386,7 +386,7 @@ macro_rules! define_bignum { /// the digit type for `Big32x40` pub type Digit32 = u32; -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] define_bignum!(Big32x40: type=Digit32, n=40); /// The digit type for `Big64x20`. @@ -395,12 +395,12 @@ pub type Digit64 = u64; #[cfg(target_pointer_width = "64")] define_bignum!(Big64x20: type=Digit64, n=20); -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] pub type Big = Big32x40; #[cfg(target_pointer_width = "64")] pub type Big = Big64x20; -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] pub type Digit = Digit32; #[cfg(target_pointer_width = "64")] pub type Digit = Digit64; diff --git a/library/core/src/num/imp/flt2dec/strategy/dragon.rs b/library/core/src/num/imp/flt2dec/strategy/dragon.rs index 4ae0d4b4ab0ba..b63b93034d57f 100644 --- a/library/core/src/num/imp/flt2dec/strategy/dragon.rs +++ b/library/core/src/num/imp/flt2dec/strategy/dragon.rs @@ -16,22 +16,22 @@ static POW10: [Digit; 10] = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]; // precalculated arrays of `Digit`s for 5^(2^n). // FIXME(#162879): these tables have u64 and u32 versions, future versions may be generated by macro. -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] static POW5TO16: [Digit; 2] = [0x86f26fc1, 0x23]; #[cfg(target_pointer_width = "64")] static POW5TO16: [Digit; 1] = [0x2386f26fc1]; -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] static POW5TO32: [Digit; 3] = [0x85acef81, 0x2d6d415b, 0x4ee]; #[cfg(target_pointer_width = "64")] static POW5TO32: [Digit; 2] = [0x2d6d415b85acef81, 0x4ee]; -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] static POW5TO64: [Digit; 5] = [0xbf6a1f01, 0x6e38ed64, 0xdaa797ed, 0xe93ff9f4, 0x184f03]; #[cfg(target_pointer_width = "64")] static POW5TO64: [Digit; 3] = [0x6e38ed64bf6a1f01, 0xe93ff9f4daa797ed, 0x184f03]; -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] static POW5TO128: [Digit; 10] = [ 0x2e953e01, 0x3df9909, 0xf1538fd, 0x2374e42f, 0xd3cff5ec, 0xc404dc08, 0xbccdb0da, 0xa6337f19, 0xe91f2603, 0x24e, @@ -40,7 +40,7 @@ static POW5TO128: [Digit; 10] = [ static POW5TO128: [Digit; 5] = [0x3df99092e953e01, 0x2374e42f0f1538fd, 0xc404dc08d3cff5ec, 0xa6337f19bccdb0da, 0x24ee91f2603]; -#[cfg(target_pointer_width = "32")] +#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))] static POW5TO256: [Digit; 19] = [ 0x982e7c01, 0xbed3875b, 0xd8d99f72, 0x12152f87, 0x6bde50c6, 0xcf4a6e70, 0xd595d80f, 0x26b2716e, 0xadc666b0, 0x1d153624, 0x3c42d35a, 0x63ff540e, 0xcc5573c0, 0x65f9ef17, 0x55bc28f2, 0x80dcc7f7,