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

Function clamp

Source/astcenc_vecmathlib_avx2_8.h:745–751  ·  view source on GitHub ↗

* @brief Return the clamped value between min and max. * * It is assumed that neither @c min nor @c max are NaN values. If @c a is NaN * then @c min will be returned for that lane. */

Source from the content-addressed store, hash-verified

743 * then @c min will be returned for that lane.
744 */
745ASTCENC_SIMD_INLINE vfloat8 clamp(float min, float max, vfloat8 a)
746{
747 // Do not reorder - second operand will return if either is NaN
748 a.m = _mm256_max_ps(a.m, _mm256_set1_ps(min));
749 a.m = _mm256_min_ps(a.m, _mm256_set1_ps(max));
750 return a;
751}
752
753/**
754 * @brief Return a clamped value between 0.0f and 1.0f.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected