From bce43186d4d6384e81794ba928805a7f6dd94c2d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 12 Jun 2016 23:58:38 +0200 Subject: api/simple-mat: drop __restrict, clang complains --- opentrack/simple-mat.hpp | 55 +++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'opentrack/simple-mat.hpp') diff --git a/opentrack/simple-mat.hpp b/opentrack/simple-mat.hpp index 9794d2d1..d56d536a 100644 --- a/opentrack/simple-mat.hpp +++ b/opentrack/simple-mat.hpp @@ -51,9 +51,6 @@ namespace { template class Mat { -#ifdef __GNUC__ - __restrict -#endif num data[h_][w_]; static_assert(h_ > 0 && w_ > 0, "must have positive mat dimensions"); @@ -64,43 +61,43 @@ public: // parameters w_ and h_ are rebound so that SFINAE occurs // removing them causes a compile-time error -sh 20150811 - + template typename std::enable_if::value, num>::type inline operator()(int i) const { return data[i][0]; } - + template typename std::enable_if::value, num>::type inline operator()(int i) const { return data[0][i]; } - + template typename std::enable_if::value, num&>::type inline operator()(int i) { return data[i][0]; } - + template typename std::enable_if::value, num&>::type inline operator()(int i) { return data[0][i]; } - + template typename std::enable_if::value, num>::type inline x() const { return operator()(0); } - + template typename std::enable_if::value, num>::type inline y() const { return operator()(1); } - + template typename std::enable_if::value, num>::type inline z() const { return operator()(2); } - + template typename std::enable_if::value, num>::type inline w() const { return operator()(3); } - + template typename std::enable_if::value, num&>::type inline x() { return operator()(0); } - + template typename std::enable_if::value, num&>::type inline y() { return operator()(1); } - + template typename std::enable_if::value, num&>::type inline z() { return operator()(2); } - + template typename std::enable_if::value, num&>::type inline w() { return operator()(3); } - + template typename std::enable_if::value, num>::type dot(const Mat& p2) const { @@ -110,7 +107,7 @@ public: ret += operator()(i) * p2(i); return ret; } - + template typename std::enable_if::value, Mat::P, is_dim3::Q>>::type cross(const Mat& p2) const @@ -119,7 +116,7 @@ public: p2.x() * z() - x() * p2.z(), x() * p2.y() - y() * p2.x()); } - + Mat operator+(const Mat& other) const { Mat ret; @@ -128,7 +125,7 @@ public: ret(j, i) = data[j][i] + other.data[j][i]; return ret; } - + Mat operator-(const Mat& other) const { Mat ret; @@ -137,7 +134,7 @@ public: ret(j, i) = data[j][i] - other.data[j][i]; return ret; } - + Mat operator+(const num& other) const { Mat ret; @@ -146,7 +143,7 @@ public: ret(j, i) = data[j][i] + other; return ret; } - + Mat operator-(const num& other) const { Mat ret; @@ -155,7 +152,7 @@ public: ret(j, i) = data[j][i] - other; return ret; } - + Mat operator*(const num other) const { Mat ret; @@ -164,7 +161,7 @@ public: ret(j, i) = data[j][i] * other; return ret; } - + template Mat operator*(const Mat& other) const { @@ -235,9 +232,9 @@ public: return ret; } - + template using dmat = Mat; - + // http://stackoverflow.com/a/18436193 static dmat<3, 1> rmat_to_euler(const dmat<3, 3>& R) { @@ -271,14 +268,14 @@ public: auto H = input[0] * pi / 180; auto P = input[1] * pi / 180; auto B = input[2] * pi / 180; - + const auto c1 = cos(H); const auto s1 = sin(H); const auto c2 = cos(P); const auto s2 = sin(P); const auto c3 = cos(B); const auto s3 = sin(B); - + double foo[] = { // z c1 * c2, @@ -293,9 +290,9 @@ public: c2 * s3, c2 * c3 }; - + return dmat<3, 3>(foo); } }; - + template using dmat = Mat; -- cgit v1.2.3