From 19a785a98ae38485cab9cf46bcc4653396a39d6e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 13 Mar 2023 03:48:44 +0300 Subject: [PATCH] public: mathlib: convert rsqrt to use float_bits_t union --- public/xash3d_mathlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/xash3d_mathlib.c b/public/xash3d_mathlib.c index 79a58c41..f0e6d52a 100644 --- a/public/xash3d_mathlib.c +++ b/public/xash3d_mathlib.c @@ -296,9 +296,9 @@ float rsqrt( float number ) return 0.0f; x = number * 0.5f; - i = *(int *)&number; // evil floating point bit level hacking + i = FloatAsInt( number ); // evil floating point bit level hacking i = 0x5f3759df - (i >> 1); // what the fuck? - y = *(float *)&i; + y = IntAsFloat( i ); y = y * (1.5f - (x * y * y)); // first iteration return y;