From 4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 11 Jul 2018 18:11:13 +0200 Subject: Roll back to ANGLE/2845 --- gfx/angle/src/common/mathutil.h | 43 ----------------------------------------- 1 file changed, 43 deletions(-) (limited to 'gfx/angle/src/common/mathutil.h') diff --git a/gfx/angle/src/common/mathutil.h b/gfx/angle/src/common/mathutil.h index 630b6c088..a82f2ecef 100755 --- a/gfx/angle/src/common/mathutil.h +++ b/gfx/angle/src/common/mathutil.h @@ -44,15 +44,6 @@ struct Vector4 float w; }; -struct Vector2 -{ - Vector2() {} - Vector2(float x, float y) : x(x), y(y) {} - - float x; - float y; -}; - inline bool isPow2(int x) { return (x & (x - 1)) == 0 && (x != 0); @@ -765,40 +756,6 @@ constexpr unsigned int iSquareRoot() return priv::iSquareRoot::value; } -// Sum, difference and multiplication operations for signed ints that wrap on 32-bit overflow. -// -// Unsigned types are defined to do arithmetic modulo 2^n in C++. For signed types, overflow -// behavior is undefined. - -template -inline T WrappingSum(T lhs, T rhs) -{ - uint32_t lhsUnsigned = static_cast(lhs); - uint32_t rhsUnsigned = static_cast(rhs); - return static_cast(lhsUnsigned + rhsUnsigned); -} - -template -inline T WrappingDiff(T lhs, T rhs) -{ - uint32_t lhsUnsigned = static_cast(lhs); - uint32_t rhsUnsigned = static_cast(rhs); - return static_cast(lhsUnsigned - rhsUnsigned); -} - -inline int32_t WrappingMul(int32_t lhs, int32_t rhs) -{ - int64_t lhsWide = static_cast(lhs); - int64_t rhsWide = static_cast(rhs); - // The multiplication is guaranteed not to overflow. - int64_t resultWide = lhsWide * rhsWide; - // Implement the desired wrapping behavior by masking out the high-order 32 bits. - resultWide = resultWide & 0xffffffffll; - // Casting to a narrower signed type is fine since the casted value is representable in the - // narrower type. - return static_cast(resultWide); -} - } // namespace gl namespace rx -- cgit v1.2.3