MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / normalize

Function normalize

external/astc-encoder/Source/astcenc_vecmathlib.h:329–333  ·  view source on GitHub ↗

* @brief Normalize a non-zero length vector to unit length. */

Source from the content-addressed store, hash-verified

327 * @brief Normalize a non-zero length vector to unit length.
328 */
329static ASTCENC_SIMD_INLINE vfloat4 normalize(vfloat4 a)
330{
331 vfloat4 length = dot(a, a);
332 return a / sqrt(length);
333}
334
335/**
336 * @brief Normalize a vector, returning @c safe if len is zero.

Callers 4

TESTFunction · 0.50

Calls 2

dotFunction · 0.70
sqrtFunction · 0.70

Tested by 1

TESTFunction · 0.40