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

Function normalize_safe

Source/astcenc_vecmathlib.h:362–371  ·  view source on GitHub ↗

* @brief Normalize a vector, returning @c safe if len is zero. */

Source from the content-addressed store, hash-verified

360 * @brief Normalize a vector, returning @c safe if len is zero.
361 */
362static ASTCENC_SIMD_INLINE vfloat4 normalize_safe(vfloat4 a, vfloat4 safe)
363{
364 vfloat4 length = dot(a, a);
365 if (length.lane<0>() != 0.0f)
366 {
367 return a / sqrt(length);
368 }
369
370 return safe;
371}
372
373
374

Calls 2

dotFunction · 0.70
sqrtFunction · 0.70

Tested by 1

TESTFunction · 0.68