reorder, for style
This commit is contained in:
parent
7ff3893aff
commit
a423f553df
|
|
@ -19,8 +19,8 @@ const E_BIAS: u8 = E_STORAGE_MAX - E_MAX;
|
||||||
const M_MASK: u8 = M_STORAGE_MAX;
|
const M_MASK: u8 = M_STORAGE_MAX;
|
||||||
const E_MASK: u8 = E_STORAGE_MAX << M_BITS;
|
const E_MASK: u8 = E_STORAGE_MAX << M_BITS;
|
||||||
|
|
||||||
#[repr(transparent)]
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
|
#[repr(transparent)]
|
||||||
pub struct F8(u8);
|
pub struct F8(u8);
|
||||||
|
|
||||||
impl F8 {
|
impl F8 {
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ impl std::ops::Mul for F8 {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
fn mul(self, rhs: Self) -> Self::Output {
|
fn mul(self, rhs: Self) -> Self::Output {
|
||||||
let (m1, e1) = self.split_unbias();
|
|
||||||
let (m2, e2) = rhs.split_unbias();
|
|
||||||
if self.0 == 0 || rhs.0 == 0 {
|
if self.0 == 0 || rhs.0 == 0 {
|
||||||
return Self(0);
|
return Self(0);
|
||||||
}
|
}
|
||||||
|
let (m1, e1) = self.split_unbias();
|
||||||
|
let (m2, e2) = rhs.split_unbias();
|
||||||
Self::merge_unbias(m1 as u32 * m2 as u32, e1 as i32 + e2 as i32)
|
Self::merge_unbias(m1 as u32 * m2 as u32, e1 as i32 + e2 as i32)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user