Trait half::vec::HalfBitsVecExt[][src]

pub trait HalfBitsVecExt: SealedHalfBitsVec {
    fn reinterpret_into<H>(self) -> Vec<H>
    where
        H: SealedHalf
; }
Expand description

Extensions to Vec<u16> to support reinterpret operations.

This trait is sealed and cannot be implemented outside of this crate.

Required methods

Reinterprets a vector of u16 bits as a vector of f16 or bf16 numbers.

H is the type to cast to, and must be either the f16 or bf16 type.

This is a zero-copy operation. The reinterpreted vector has the same memory location as self.

Examples
let int_buffer = vec![f16::from_f32(1.).to_bits(), f16::from_f32(2.).to_bits(), f16::from_f32(3.).to_bits()];
let float_buffer = int_buffer.reinterpret_into::<f16>();

assert_eq!(float_buffer, [f16::from_f32(1.), f16::from_f32(2.), f16::from_f32(3.)]);

Implementations on Foreign Types

Implementors