add basic constants

This commit is contained in:
numzero 2026-02-17 03:58:22 +03:00
parent fe44566139
commit f84c434a1c

View File

@ -32,6 +32,11 @@ 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;
/// 8-bit unsigned binary floating-point type, with [`M_BITS`] mantissa bits and [`E_BITS`] exponent 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)] #[repr(transparent)]
pub struct F8(u8); pub struct F8(u8);
impl F8 {
pub const ZERO: Self = Self(0);
pub const ONE: Self = Self::merge(0, E_BIAS);
}