Skip to content

Commit 1e3e1a4

Browse files
committed
Remove cycles from constant definitions
1 parent d3dcff9 commit 1e3e1a4

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/most8.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ pub trait Most8<const E: u32, const M: u32>:
6363
const M: u32 = M;
6464

6565
/// Exponent bias
66-
const B: i32 = Self::B;
66+
const B: i32;
6767

6868
/// NaN encoding style
69-
const N: NanStyle = Self::N;
69+
const N: NanStyle;
7070

7171
/// Total bitwidth
7272
const BITWIDTH: u32 = 1 + E + M;
@@ -124,37 +124,37 @@ pub trait Most8<const E: u32, const M: u32>:
124124
const MIN_10_EXP: i32 = ((Self::MIN_EXP - 1) as f64 * crate::LOG10_2) as i32;
125125

126126
/// One representation of NaN
127-
const NAN: Self = Self::NAN;
127+
const NAN: Self;
128128

129129
/// The largest number of this type
130130
///
131131
/// This value would be +∞ if the type has infinities. Otherwise, it is
132132
/// the maximum finite representation. This value is also the result of
133133
/// a positive overflow.
134-
const HUGE: Self = Self::HUGE;
134+
const HUGE: Self;
135135

136136
/// The maximum finite number
137-
const MAX: Self = Self::MAX;
137+
const MAX: Self;
138138

139139
/// The smallest positive (subnormal) number
140-
const TINY: Self = Self::TINY;
140+
const TINY: Self;
141141

142142
/// The smallest positive normal number
143143
///
144144
/// Equal to 2<sup>[`MIN_EXP`][Self::MIN_EXP]&minus;1</sup>
145-
const MIN_POSITIVE: Self = Self::MIN_POSITIVE;
145+
const MIN_POSITIVE: Self;
146146

147147
/// [Machine epsilon](https://en.wikipedia.org/wiki/Machine_epsilon)
148148
///
149149
/// The difference between 1.0 and the next larger representable number.
150150
///
151151
/// Equal to 2<sup>&minus;`M`</sup>.
152-
const EPSILON: Self = Self::EPSILON;
152+
const EPSILON: Self;
153153

154154
/// The minimum finite number
155155
///
156156
/// Equal to &minus;[`MAX`][Self::MAX]
157-
const MIN: Self = Self::MIN;
157+
const MIN: Self;
158158

159159
/// Magnitude mask for internal usage
160160
const ABS_MASK: u8 = (1 << (E + M)) - 1;
@@ -597,6 +597,17 @@ macro_rules! most8 {
597597
}
598598

599599
impl $crate::Most8<$e, $m> for $name {
600+
const B: i32 = $b;
601+
const N: $crate::NanStyle = $crate::NanStyle::$n;
602+
603+
const NAN: Self = Self::NAN;
604+
const HUGE: Self = Self::HUGE;
605+
const MAX: Self = Self::MAX;
606+
const TINY: Self = Self::TINY;
607+
const MIN_POSITIVE: Self = Self::MIN_POSITIVE;
608+
const EPSILON: Self = Self::EPSILON;
609+
const MIN: Self = Self::MIN;
610+
600611
fn from_bits(v: u8) -> Self {
601612
Self::from_bits(v)
602613
}

0 commit comments

Comments
 (0)