diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-03-05 21:46:31 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-05 21:46:31 +0800 |
| commit | 9b8accbeb6336fa24d02b2a8bcaecaf44fe2bb65 (patch) | |
| tree | 25ea2b9fbd95ced25afbfef27cf9bfaf36bc4692 /src/etc/test-float-parse | |
| parent | 4559163ccb500affc424fb9228dae5003672ffc7 (diff) | |
| parent | 37e223ccaa1d0036540e6e3de5d4ed4b721afd60 (diff) | |
| download | rust-9b8accbeb6336fa24d02b2a8bcaecaf44fe2bb65.tar.gz rust-9b8accbeb6336fa24d02b2a8bcaecaf44fe2bb65.zip | |
Rollup merge of #134063 - tgross35:dec2flt-refactoring, r=Noratrieb
dec2flt: Clean up float parsing modules This is the first portion of my work adding support for parsing and printing `f16`. Changes in `float.rs` replace the magic constants with expressions and add some use of generics to better support the new float types. Everything else is related to documentation or naming; there are no functional changes in this PR. This can be reviewed by commit.
Diffstat (limited to 'src/etc/test-float-parse')
| -rw-r--r-- | src/etc/test-float-parse/src/traits.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/etc/test-float-parse/src/traits.rs b/src/etc/test-float-parse/src/traits.rs index c8407ba7cc5..57e702b7d09 100644 --- a/src/etc/test-float-parse/src/traits.rs +++ b/src/etc/test-float-parse/src/traits.rs @@ -147,12 +147,12 @@ pub trait Float: } macro_rules! impl_float { - ($($fty:ty, $ity:ty, $bits:literal);+) => { + ($($fty:ty, $ity:ty);+) => { $( impl Float for $fty { type Int = $ity; type SInt = <Self::Int as Int>::Signed; - const BITS: u32 = $bits; + const BITS: u32 = <$ity>::BITS; const MAN_BITS: u32 = Self::MANTISSA_DIGITS - 1; const MAN_MASK: Self::Int = (Self::Int::ONE << Self::MAN_BITS) - Self::Int::ONE; const SIGN_MASK: Self::Int = Self::Int::ONE << (Self::BITS-1); @@ -168,7 +168,7 @@ macro_rules! impl_float { } } -impl_float!(f32, u32, 32; f64, u64, 64); +impl_float!(f32, u32; f64, u64); /// A test generator. Should provide an iterator that produces unique patterns to parse. /// |
