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.
This commit is contained in:
commit
9b8accbeb6
18 changed files with 851 additions and 600 deletions
|
|
@ -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.
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue