Trait HalfBitsVecExt
pub trait HalfBitsVecExt: SealedHalfBitsVec
Extensions to [Vec<u16>] to support reinterpret operations.
This trait is sealed and cannot be implemented outside of this crate.
Required Methods
fn reinterpret_into<H>(self) -> Vec<H> where H: SealedHalf,Reinterprets a vector of
u16bits as a vector of [struct@f16] orbf16numbers.His the type to cast to, and must be either the [struct@f16] orbf16type.This is a zero-copy operation. The reinterpreted vector has the same memory location as
self.Examples
# use half::prelude::*; 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.)]);
Implementors
impl HalfBitsVecExt for Vec<u16>