added glm_vec_fill() (#100)

* alternative name for _broadcast(): _fill()
This commit is contained in:
Luigi Castelli
2019-08-26 08:19:26 +02:00
committed by Recep Aslantas
parent 4639f3184a
commit 144624962a
8 changed files with 80 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
/*
Functions:
CGLM_INLINE void glm_vec4_broadcast(float val, vec4 d);
CGLM_INLINE void glm_vec4_fill(vec4 v, float val);
CGLM_INLINE bool glm_vec4_eq(vec4 v, float val);
CGLM_INLINE bool glm_vec4_eq_eps(vec4 v, float val);
CGLM_INLINE bool glm_vec4_eq_all(vec4 v);
@@ -48,6 +49,22 @@ glm_vec4_broadcast(float val, vec4 d) {
#endif
}
/*!
* @brief fill a vector with specified value
*
* @param v dest
* @param val value
*/
CGLM_INLINE
void
glm_vec4_fill(vec4 v, float val) {
#if defined( __SSE__ ) || defined( __SSE2__ )
glmm_store(v, _mm_set1_ps(val));
#else
v[0] = v[1] = v[2] = v[3] = val;
#endif
}
/*!
* @brief check if vector is equal to value (without epsilon)
*