add basic constants

This commit is contained in:
numzero 2026-02-17 03:58:22 +03:00
parent f0468502d8
commit 40ba11f33c

View File

@ -32,6 +32,11 @@ const M_MASK: u8 = M_STORAGE_MAX;
const E_MASK: u8 = E_STORAGE_MAX << M_BITS;
/// 8-bit unsigned binary floating-point type, with [`M_BITS`] mantissa bits and [`E_BITS`] exponent bits.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
#[repr(transparent)]
pub struct F8(u8);
impl F8 {
pub const ZERO: Self = Self(0);
pub const ONE: Self = Self::merge(0, E_BIAS);
}