summaryrefslogtreecommitdiff
path: root/external/box2d/fix-strict-aliasing-error.patch
blob: 20b5e49eb93600949f9b60a3aca95128d8d3eb45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
diff -ru box2d/Box2D/Box2D/Common/b2Math.h box2d_patched/Box2D/Box2D/Common/b2Math.h
--- box2d/Box2D/Box2D/Common/b2Math.h	2014-04-06 03:43:12.000000000 +0300
+++ box2d_patched/Box2D/Box2D/Common/b2Math.h	2020-06-16 07:37:31.713248714 +0300
@@ -25,8 +25,7 @@
 /// This function is used to ensure that a floating point number is not a NaN or infinity.
 inline bool b2IsValid(float32 x)
 {
-	int32 ix = *reinterpret_cast<int32*>(&x);
-	return (ix & 0x7f800000) != 0x7f800000;
+	return isfinite(x);
 }
 
 /// This is a approximate yet fast inverse square-root.