Browse Source

Adding FloatToRawIntBits

The FloatToRawIntBits function is used to calculate float hashes.
CG-SS 8 years ago
parent
commit
59e0939c75
1 changed files with 9 additions and 0 deletions
  1. 9 0
      Source/Urho3D/Math/MathDefs.h

+ 9 - 0
Source/Urho3D/Math/MathDefs.h

@@ -272,6 +272,15 @@ inline float HalfToFloat(unsigned short value)
     return out;
 }
 
+// Returns a representation of the specified floating-point value as a single format bit layout.
+inline unsigned FloatToRawIntBits(float x)
+{
+    unsigned y;
+	memcpy(&y, &x, 4);
+	
+    return y;
+}
+
 /// Calculate both sine and cosine, with angle in degrees.
 URHO3D_API void SinCos(float angle, float& sin, float& cos);