Skip to content

Commit 10af806

Browse files
committed
fixup! float: Add f16 parsing and printing
1 parent 35e8c9c commit 10af806

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/etc/test-float-parse/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(f16)]
2-
31
mod traits;
42
mod ui;
53
mod validate;
@@ -116,7 +114,6 @@ pub fn register_tests(cfg: &Config) -> Vec<TestInfo> {
116114
let mut tests = Vec::new();
117115

118116
// Register normal generators for all floats.
119-
register_float::<f16>(&mut tests, cfg);
120117
register_float::<f32>(&mut tests, cfg);
121118
register_float::<f64>(&mut tests, cfg);
122119

src/etc/test-float-parse/src/traits.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ macro_rules! impl_int {
9898
}
9999
}
100100

101-
impl_int!(u16, i16; u32, i32; u64, i64);
101+
impl_int!(u32, i32; u64, i64);
102102

103103
/// Floating point types.
104104
pub trait Float:
@@ -147,12 +147,12 @@ pub trait Float:
147147
}
148148

149149
macro_rules! impl_float {
150-
($($fty:ty, $ity:ty);+) => {
150+
($($fty:ty, $ity:ty, $bits:literal);+) => {
151151
$(
152152
impl Float for $fty {
153153
type Int = $ity;
154154
type SInt = <Self::Int as Int>::Signed;
155-
const BITS: u32 = <$ity>::BITS;
155+
const BITS: u32 = $bits;
156156
const MAN_BITS: u32 = Self::MANTISSA_DIGITS - 1;
157157
const MAN_MASK: Self::Int = (Self::Int::ONE << Self::MAN_BITS) - Self::Int::ONE;
158158
const SIGN_MASK: Self::Int = Self::Int::ONE << (Self::BITS-1);
@@ -168,7 +168,7 @@ macro_rules! impl_float {
168168
}
169169
}
170170

171-
impl_float!(f16, u16; f32, u32; f64, u64);
171+
impl_float!(f32, u32, 32; f64, u64, 64);
172172

173173
/// A test generator. Should provide an iterator that produces unique patterns to parse.
174174
///

0 commit comments

Comments
 (0)