From 40ba11f33c658adf539bdec24ed81a17af6c9ffd Mon Sep 17 00:00:00 2001 From: numzero Date: Tue, 17 Feb 2026 03:58:22 +0300 Subject: [PATCH] add basic constants --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c082250..ba65b21 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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); +}