浏览代码

Add contributor. Prefer union-based float to raw bits conversion.

Lasse Öörni 8 年之前
父节点
当前提交
e4fe4f04bb
共有 3 个文件被更改,包括 10 次插入4 次删除
  1. 1 0
      Docs/Urho3D.dox
  2. 1 0
      README.md
  3. 8 4
      Source/Urho3D/Math/MathDefs.h

+ 1 - 0
Docs/Urho3D.dox

@@ -133,6 +133,7 @@ Urho3D development, contributions and bugfixes by:
 - Steven Zhang
 - AGreatFish
 - BlueMagnificent
+- CG-SS
 - Enhex
 - Fastran
 - Firegorilla

+ 1 - 0
README.md

@@ -88,6 +88,7 @@ Urho3D development, contributions and bugfixes by:
 - Steven Zhang
 - AGreatFish
 - BlueMagnificent
+- CG-SS
 - Enhex
 - Fastran
 - Firegorilla

+ 8 - 4
Source/Urho3D/Math/MathDefs.h

@@ -275,10 +275,14 @@ inline float HalfToFloat(unsigned short value)
 // 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;
+    union
+    {
+        unsigned i;
+        float x;
+    } u;
+
+    u.x = x;
+    return u.i;
 }
 
 /// Calculate both sine and cosine, with angle in degrees.