ref: 08d0015032b413d93ea4e7aa18c26c94bf69f29d
parent: e37f85314d33a5c37c11f8428f37050c0f03e403
author: David <gek@katherine>
date: Thu Mar 11 14:21:22 EST 2021
Automatic commit.
--- a/src/zmath.h
+++ b/src/zmath.h
@@ -66,6 +66,7 @@
}
*/
#if TGL_FEATURE_FISR == 1
+/*
inline GLfloat fastInvSqrt(float x){
union{GLfloat f; GLint i;} conv;
conv.f = x;
@@ -72,6 +73,16 @@
conv.i = 0x5F1FFFF9 - (conv.i>>1);
conv.f *= 0.703952253f * (2.38924456f - x * conv.f * conv.f);
return conv.f;
+}*/
+//Defined behavior fastinvsqrt
+inline GLfloat fastInvSqrt(GLfloat x){
+ GLint i;
+ GLfloat x2;
+ memcpy(&i, &x, 4);
+ i = 0x5F1FFFF9 - (i>>1);
+ memcpy(&x2, &i, 4);
+ x2 *= 0.703952253f * (2.38924456f - x * x2 * x2);
+ return x2;
}
#endif