Fixed really stupid mistake.

- Whoops, accidentally took x to the 4th power in MATH_Fast_Invert().
This commit is contained in:
Falco Girgis 2025-02-28 23:01:15 -06:00
parent f0052c79b9
commit 430ab335de

View file

@ -166,13 +166,13 @@ static_assert(alignof(pvr_vertex16_t) == 32, "pvr_vertex16_t alignof mismatch");
#define MATH_Very_Fast_Invert(x) ({ 1.0f / sqrtf((x) * (x)); }) #define MATH_Very_Fast_Invert(x) ({ 1.0f / sqrtf((x) * (x)); })
static inline __attribute__((always_inline)) float MATH_Fast_Invert(float x) { __always_inline float MATH_Fast_Invert(float x) {
bool neg = 0; bool neg = 0;
if(x < 0.0f) if(x < 0.0f)
neg = true; neg = true;
x = MATH_Very_Fast_Invert(x*x); // 1.0f / sqrt(x^2) x = MATH_Very_Fast_Invert(x); // 1.0f / sqrt(x^2)
return (neg)? -x : x; return (neg)? -x : x;
} }