pub struct F32Grid {
pub bit_step: u32,
pub subnormals: Option<SubnormalRange>,
}Expand description
A narrower float format’s grid, laid over the f32 bit pattern.
f32 carries every param this exists for exactly, so the grid can be walked there rather than
through the storage type. A value representable in the param leaves the low f32 mantissa bits
zero, so one param ulp is an increment at that position and the carry into the exponent falls
out on its own. Working in f32 also keeps the grid available to backends with no narrow integer,
and to builds without the fp8 feature.
Fields§
§bit_step: u32One step up in the normal range, as an increment on the f32 bit pattern.
subnormals: Option<SubnormalRange>The param’s subnormals, for the formats whose subnormals land in f32’s normal range.
Implementations§
Source§impl F32Grid
impl F32Grid
Sourcepub fn truncate_mask(&self) -> u32
pub fn truncate_mask(&self) -> u32
Clears the mantissa bits the param does not carry, truncating a bit pattern onto the grid.
Sourcepub fn round_up_bias(&self) -> u32
pub fn round_up_bias(&self) -> u32
Added to a bit pattern before truncate_mask to turn that truncation
into a round up. The carry it can produce is only safe below the param’s maximum, which is
why callers saturate there first.
Trait Implementations§
impl Copy for F32Grid
impl StructuralPartialEq for F32Grid
Auto Trait Implementations§
impl Freeze for F32Grid
impl RefUnwindSafe for F32Grid
impl Send for F32Grid
impl Sync for F32Grid
impl Unpin for F32Grid
impl UnsafeUnpin for F32Grid
impl UnwindSafe for F32Grid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more