Browse Source

Avoid depending on 64-bit only function _mm_cvtsi128_si64() in Matrix operator == to allow targeting 32-bit as well.

Jukka Jylänki 10 years ago
parent
commit
3ac2cb6e37
2 changed files with 6 additions and 2 deletions
  1. 3 1
      Source/Urho3D/Math/Matrix3x4.h
  2. 3 1
      Source/Urho3D/Math/Matrix4.h

+ 3 - 1
Source/Urho3D/Math/Matrix3x4.h

@@ -249,7 +249,9 @@ public:
         c0 = _mm_and_ps(c0, c2);
         __m128 hi = _mm_movehl_ps(c0, c0);
         c0 = _mm_and_ps(c0, hi);
-        return _mm_cvtsi128_si64(_mm_castps_si128(c0)) == -1LL;
+        hi = _mm_shuffle_ps(c0, c0, _MM_SHUFFLE(1, 1, 1, 1));
+        c0 = _mm_and_ps(c0, hi);
+        return !_mm_ucomige_ss(c0, c0);
 #else
         const float* leftData = Data();
         const float* rightData = rhs.Data();

+ 3 - 1
Source/Urho3D/Math/Matrix4.h

@@ -234,7 +234,9 @@ public:
         c0 = _mm_and_ps(c0, c2);
         __m128 hi = _mm_movehl_ps(c0, c0);
         c0 = _mm_and_ps(c0, hi);
-        return _mm_cvtsi128_si64(_mm_castps_si128(c0)) == -1LL;
+        hi = _mm_shuffle_ps(c0, c0, _MM_SHUFFLE(1, 1, 1, 1));
+        c0 = _mm_and_ps(c0, hi);
+        return !_mm_ucomige_ss(c0, c0);
 #else
         const float* leftData = Data();
         const float* rightData = rhs.Data();