starkat99 / half-rs

Half-precision floating point types f16 and bf16 for Rust.
https://docs.rs/half/
Other
232 stars 52 forks source link

More #[inline] in HalfFloatSliceExt, leading_zeros #81

Closed encounter closed 1 year ago

encounter commented 1 year ago

This helps code generation for situations with fixed size arrays:

let src: [f16; 4];
let mut dst = [0f32; 4];
src.convert_to_f32_slice(&mut dst);
// ^ This will get optimized to a direct f16x4_to_f32x4

Without the inline modifier, convert_to_f32_slice is always generated as a generic function across arbitrary length slices.