Skip to content

Commit f96c7cd

Browse files
committed
Some updates to build slightly better
1 parent 98ee8c0 commit f96c7cd

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

library/core/src/num/dec2flt/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ macro_rules! from_str_float_impl {
171171
}
172172
};
173173
}
174+
175+
#[cfg(not(bootstrap))]
176+
from_str_float_impl!(f16);
174177
from_str_float_impl!(f32);
175178
from_str_float_impl!(f64);
176179

library/core/src/num/dec2flt/number.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Number {
6464
return None;
6565
}
6666

67-
let mut value = if self.exponent <= F::MAX_EXPONENT_FAST_PATH {
67+
let value = if self.exponent <= F::MAX_EXPONENT_FAST_PATH {
6868
// normal fast path
6969
let value = F::from_u64(self.mantissa);
7070
if self.exponent < 0 {

library/core/src/num/f16.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,8 @@ impl f16 {
246246
pub(crate) const SIGN_MASK: u16 = 0x8000;
247247

248248
/// Exponent mask
249-
#[cfg(not(bootstrap))]
250249
pub(crate) const EXP_MASK: u16 = 0x7c00;
251250

252-
#[cfg(not(bootstrap))]
253251
pub(crate) const MAN_MASK: u16 = 0x03ff;
254252

255253
/// Minimum representable positive value (min subnormal)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(f16)]
2+
13
mod traits;
24
mod ui;
35
mod validate;
@@ -114,6 +116,7 @@ pub fn register_tests(cfg: &Config) -> Vec<TestInfo> {
114116
let mut tests = Vec::new();
115117

116118
// Register normal generators for all floats.
119+
register_float::<f16>(&mut tests, cfg);
117120
register_float::<f32>(&mut tests, cfg);
118121
register_float::<f64>(&mut tests, cfg);
119122

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ macro_rules! impl_int {
9898
}
9999
}
100100

101-
impl_int!(u32, i32; u64, i64);
101+
impl_int!(u16, i16; 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, $bits:literal);+) => {
150+
($($fty:ty, $ity:ty);+) => {
151151
$(
152152
impl Float for $fty {
153153
type Int = $ity;
154154
type SInt = <Self::Int as Int>::Signed;
155-
const BITS: u32 = $bits;
155+
const BITS: u32 = <$ity>::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!(f32, u32, 32; f64, u64, 64);
171+
impl_float!(f16, u16; f32, u32; f64, u64);
172172

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

0 commit comments

Comments
 (0)