From 24fe33358c0b99e77b6646db3c4914683a7a58c0 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Mon, 17 Feb 2020 20:49:40 +0000 Subject: [PATCH] Faster floor --- GL/lighting.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GL/lighting.c b/GL/lighting.c index b462d42..2dab278 100644 --- a/GL/lighting.c +++ b/GL/lighting.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "private.h" @@ -278,8 +279,10 @@ GL_FORCE_INLINE float FEXP(float y) { #define LOGBODGE 0.346607f #define POWBODGE 0.33971f +const static float FINT_MAX = (float) INT_MAX; + GL_FORCE_INLINE float FFLOOR(float x) { - return (int) x - (x < (int) x); + return (int)(x + FINT_MAX) - INT_MAX; } GL_FORCE_INLINE float FLOG2(float i) {