summaryrefslogtreecommitdiff
path: root/src/common/vector_math.h
diff options
context:
space:
mode:
authorGravatar bunnei2017-10-09 23:56:20 -0400
committerGravatar bunnei2017-10-09 23:56:20 -0400
commitb1d5db1cf60344b6b081c9d03cb6ccc3264326cd (patch)
treefde377c4ba3c0f92c032e6f5ec8627aae37270ef /src/common/vector_math.h
parentloader: Various improvements for NSO/NRO loaders. (diff)
parentMerge pull request #2996 from MerryMage/split-travis (diff)
downloadyuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.gz
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.xz
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.zip
Merge remote-tracking branch 'upstream/master' into nx
# Conflicts: # src/core/CMakeLists.txt # src/core/arm/dynarmic/arm_dynarmic.cpp # src/core/arm/dyncom/arm_dyncom.cpp # src/core/hle/kernel/process.cpp # src/core/hle/kernel/thread.cpp # src/core/hle/kernel/thread.h # src/core/hle/kernel/vm_manager.cpp # src/core/loader/3dsx.cpp # src/core/loader/elf.cpp # src/core/loader/ncch.cpp # src/core/memory.cpp # src/core/memory.h # src/core/memory_setup.h
Diffstat (limited to 'src/common/vector_math.h')
-rw-r--r--src/common/vector_math.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/common/vector_math.h b/src/common/vector_math.h
index c7a461a1e..3f0057d9e 100644
--- a/src/common/vector_math.h
+++ b/src/common/vector_math.h
@@ -90,8 +90,9 @@ public:
90 x -= other.x; 90 x -= other.x;
91 y -= other.y; 91 y -= other.y;
92 } 92 }
93 template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> 93
94 Vec2<decltype(-T{})> operator-() const { 94 template <typename U = T>
95 Vec2<std::enable_if_t<std::is_signed<U>::value, U>> operator-() const {
95 return MakeVec(-x, -y); 96 return MakeVec(-x, -y);
96 } 97 }
97 Vec2<decltype(T{} * T{})> operator*(const Vec2& other) const { 98 Vec2<decltype(T{} * T{})> operator*(const Vec2& other) const {
@@ -103,8 +104,7 @@ public:
103 } 104 }
104 template <typename V> 105 template <typename V>
105 void operator*=(const V& f) { 106 void operator*=(const V& f) {
106 x *= f; 107 *this = *this * f;
107 y *= f;
108 } 108 }
109 template <typename V> 109 template <typename V>
110 Vec2<decltype(T{} / V{})> operator/(const V& f) const { 110 Vec2<decltype(T{} / V{})> operator/(const V& f) const {
@@ -247,8 +247,9 @@ public:
247 y -= other.y; 247 y -= other.y;
248 z -= other.z; 248 z -= other.z;
249 } 249 }
250 template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> 250
251 Vec3<decltype(-T{})> operator-() const { 251 template <typename U = T>
252 Vec3<std::enable_if_t<std::is_signed<U>::value, U>> operator-() const {
252 return MakeVec(-x, -y, -z); 253 return MakeVec(-x, -y, -z);
253 } 254 }
254 Vec3<decltype(T{} * T{})> operator*(const Vec3& other) const { 255 Vec3<decltype(T{} * T{})> operator*(const Vec3& other) const {
@@ -260,9 +261,7 @@ public:
260 } 261 }
261 template <typename V> 262 template <typename V>
262 void operator*=(const V& f) { 263 void operator*=(const V& f) {
263 x *= f; 264 *this = *this * f;
264 y *= f;
265 z *= f;
266 } 265 }
267 template <typename V> 266 template <typename V>
268 Vec3<decltype(T{} / V{})> operator/(const V& f) const { 267 Vec3<decltype(T{} / V{})> operator/(const V& f) const {
@@ -462,8 +461,9 @@ public:
462 z -= other.z; 461 z -= other.z;
463 w -= other.w; 462 w -= other.w;
464 } 463 }
465 template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> 464
466 Vec4<decltype(-T{})> operator-() const { 465 template <typename U = T>
466 Vec4<std::enable_if_t<std::is_signed<U>::value, U>> operator-() const {
467 return MakeVec(-x, -y, -z, -w); 467 return MakeVec(-x, -y, -z, -w);
468 } 468 }
469 Vec4<decltype(T{} * T{})> operator*(const Vec4& other) const { 469 Vec4<decltype(T{} * T{})> operator*(const Vec4& other) const {
@@ -475,10 +475,7 @@ public:
475 } 475 }
476 template <typename V> 476 template <typename V>
477 void operator*=(const V& f) { 477 void operator*=(const V& f) {
478 x *= f; 478 *this = *this * f;
479 y *= f;
480 z *= f;
481 w *= f;
482 } 479 }
483 template <typename V> 480 template <typename V>
484 Vec4<decltype(T{} / V{})> operator/(const V& f) const { 481 Vec4<decltype(T{} / V{})> operator/(const V& f) const {
@@ -721,4 +718,4 @@ static inline Vec4<T> MakeVec(const T& x, const Vec3<T>& yzw) {
721 return MakeVec(x, yzw[0], yzw[1], yzw[2]); 718 return MakeVec(x, yzw[0], yzw[1], yzw[2]);
722} 719}
723 720
724} // namespace 721} // namespace Math