#[repr(transparent)]pub struct Q31(pub i32);Expand description
Strongly-typed Q1.31 fixed-point number stored in an i32.
Range is [-1.0, 0.9999999995343387].
Provides operator overloading (+, -, *, /) with saturating fixed-point arithmetic.
Tuple Fields§
§0: i32Implementations§
Source§impl Q31
impl Q31
Sourcepub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
Saturating addition.
Sourcepub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction.
Sourcepub fn saturating_mul(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: Self) -> Self
Saturating Q31 multiplication.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Saturating Q31 division with division-by-zero protection.
Trait Implementations§
Source§impl AddAssign for Q31
impl AddAssign for Q31
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreimpl Copy for Q31
Source§impl DivAssign for Q31
impl DivAssign for Q31
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreimpl Eq for Q31
Source§impl MulAssign for Q31
impl MulAssign for Q31
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl Ord for Q31
impl Ord for Q31
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Q31
impl PartialOrd for Q31
impl StructuralPartialEq for Q31
Auto Trait Implementations§
impl Freeze for Q31
impl RefUnwindSafe for Q31
impl Send for Q31
impl Sync for Q31
impl Unpin for Q31
impl UnsafeUnpin for Q31
impl UnwindSafe for Q31
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
Mutably borrows from an owned value. Read more