Trait culsynth::Fixed16

source ·
pub trait Fixed16: Fixed {
    type Widened: Fixed;

    const ONE_OR_MAX: Self = _;

    // Required methods
    fn multiply_fixed(self, rhs: Self) -> Self;
    fn scale_fixed(self, rhs: ScalarFxP) -> Self;
    fn widen(self) -> Self::Widened;
    fn widened_from_bits(bits: i32) -> Self::Widened;
}
Expand description

A trait encompassing 16 bit fixed point numbers along with a couple of convenience methods for the type.

Required Associated Types§

source

type Widened: Fixed

A 32 bit fixed point number with the same number of fractional bits

Provided Associated Constants§

source

const ONE_OR_MAX: Self = _

The value one, or if one is not representable, the maximum representable by the type

Required Methods§

source

fn multiply_fixed(self, rhs: Self) -> Self

Multiply two fixed point numbers

source

fn scale_fixed(self, rhs: ScalarFxP) -> Self

Scale a fixed point number

source

fn widen(self) -> Self::Widened

Widen this to a Self::Widened

source

fn widened_from_bits(bits: i32) -> Self::Widened

Create a widened from bits

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<N> Fixed16 for FixedI16<N>
where N: Unsigned + LeEqU16 + LeEqU32 + Add<N> + Add<U16>, Sum<N, N>: Unsigned + LeEqU32, Sum<N, U16>: Unsigned + LeEqU32,

source§

fn multiply_fixed(self, rhs: Self) -> Self

source§

fn scale_fixed(self, rhs: ScalarFxP) -> Self

§

type Widened = FixedI32<<FixedI16<N> as Fixed>::Frac>

source§

fn widen(self) -> FixedI32<Self::Frac>

source§

fn widened_from_bits(bits: i32) -> Self::Widened

source§

impl<N> Fixed16 for FixedU16<N>
where N: Unsigned + LeEqU16 + LeEqU32 + Add<N> + Add<U16>, Sum<N, N>: Unsigned + LeEqU32, Sum<N, U16>: Unsigned + LeEqU32,

source§

fn multiply_fixed(self, rhs: Self) -> Self

source§

fn scale_fixed(self, rhs: ScalarFxP) -> Self

§

type Widened = FixedI32<<FixedU16<N> as Fixed>::Frac>

source§

fn widen(self) -> FixedI32<Self::Frac>

source§

fn widened_from_bits(bits: i32) -> Self::Widened

Implementors§