MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / float_to_float16

Function float_to_float16

Source/astcenc_vecmathlib_neon_4.h:898–907  ·  view source on GitHub ↗

* @brief Return a float16 value for a float vector, using round-to-nearest. */

Source from the content-addressed store, hash-verified

896 * @brief Return a float16 value for a float vector, using round-to-nearest.
897 */
898ASTCENC_SIMD_INLINE vint4 float_to_float16(vfloat4 a)
899{
900 // Generate float16 value
901 float16x4_t f16 = vcvt_f16_f32(a.m);
902
903 // Convert each 16-bit float pattern to a 32-bit pattern
904 uint16x4_t u16 = vreinterpret_u16_f16(f16);
905 uint32x4_t u32 = vmovl_u16(u16);
906 return vint4(vreinterpretq_s32_u32(u32));
907}
908
909/**
910 * @brief Return a float16 value for a float scalar, using round-to-nearest.

Callers

nothing calls this directly

Calls 1

vint4Class · 0.70

Tested by

no test coverage detected