Trait vortex_alp::ALPRDFloat

source ·
pub trait ALPRDFloat:
    Sealed
    + Float
    + Copy
    + NativePType {
    type UINT: NativePType + PrimInt + One + Copy;

    const BITS: usize = _;

    // Required methods
    fn from_bits(bits: Self::UINT) -> Self;
    fn to_bits(value: Self) -> Self::UINT;
    fn to_u16(bits: Self::UINT) -> u16;
    fn from_u16(value: u16) -> Self::UINT;
}
Expand description

Main trait for ALP-RD encodable floating point numbers.

Like the paper, we limit this to the IEEE7 754 single-precision (f32) and double-precision (f64) floating point types.

Required Associated Types§

source

type UINT: NativePType + PrimInt + One + Copy

The unsigned integer type with the same bit-width as the floating-point type.

Provided Associated Constants§

source

const BITS: usize = _

Number of bits the value occupies in registers.

Required Methods§

source

fn from_bits(bits: Self::UINT) -> Self

Bit-wise transmute from the unsigned integer type to the floating-point type.

source

fn to_bits(value: Self) -> Self::UINT

Bit-wise transmute into the unsigned integer type.

source

fn to_u16(bits: Self::UINT) -> u16

Truncating conversion from the unsigned integer type to u16.

source

fn from_u16(value: u16) -> Self::UINT

Type-widening conversion from u16 to the unsigned integer type.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ALPRDFloat for f32

source§

type UINT = u32

source§

fn from_bits(bits: Self::UINT) -> Self

source§

fn to_bits(value: Self) -> Self::UINT

source§

fn to_u16(bits: Self::UINT) -> u16

source§

fn from_u16(value: u16) -> Self::UINT

source§

impl ALPRDFloat for f64

source§

type UINT = u64

source§

fn from_bits(bits: Self::UINT) -> Self

source§

fn to_bits(value: Self) -> Self::UINT

source§

fn to_u16(bits: Self::UINT) -> u16

source§

fn from_u16(value: u16) -> Self::UINT

Implementors§