From 233ccf421e2c948bb7870c8fbb98b4325ee892ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 15 Nov 2014 22:13:36 -0800 Subject: [PATCH] Added fwrap. --- include/bx/fpumath.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/bx/fpumath.h b/include/bx/fpumath.h index 468480d..1429b59 100644 --- a/include/bx/fpumath.h +++ b/include/bx/fpumath.h @@ -112,6 +112,13 @@ namespace bx return equal; } + inline float fwrap(float _a, float _wrap) + { + const float mod = fmodf(_a, _wrap); + const float result = mod < 0.0f ? _wrap + mod : mod; + return result; + } + inline void vec3Move(float* __restrict _result, const float* __restrict _a) { _result[0] = _a[0];