From 00523f0b8917abd6e7a3e38de1362d0692064a52 Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Sun, 1 Mar 2020 12:56:11 +0300 Subject: [PATCH] helper to swap two float values --- include/cglm/util.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/cglm/util.h b/include/cglm/util.h index 7b77cb8..66fcee0 100644 --- a/include/cglm/util.h +++ b/include/cglm/util.h @@ -325,4 +325,19 @@ glm_percentc(float from, float to, float current) { return glm_clamp(glm_percent(from, to, current), 0.0f, 1.0f); } +/*! +* @brief swap two float values +* +* @param[in] a float value 1 (pointer) +* @param[in] b float value 2 (pointer) +*/ +CGLM_INLINE +void +glm_swapf(float * __restrict a, float * __restrict b) { + float t; + t = *a; + *a = *b; + *b = t; +} + #endif /* cglm_util_h */