| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef Sk2x_DEFINED | 8 #ifndef Sk2x_DEFINED |
| 9 #define Sk2x_DEFINED | 9 #define Sk2x_DEFINED |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 Sk2x& operator=(const Sk2x&); | 42 Sk2x& operator=(const Sk2x&); |
| 43 | 43 |
| 44 // These assume no particular alignment. | 44 // These assume no particular alignment. |
| 45 static Sk2x Load(const T[2]); | 45 static Sk2x Load(const T[2]); |
| 46 void store(T[2]) const; | 46 void store(T[2]) const; |
| 47 | 47 |
| 48 Sk2x add(const Sk2x&) const; | 48 Sk2x add(const Sk2x&) const; |
| 49 Sk2x subtract(const Sk2x&) const; | 49 Sk2x subtract(const Sk2x&) const; |
| 50 Sk2x multiply(const Sk2x&) const; | 50 Sk2x multiply(const Sk2x&) const; |
| 51 | 51 |
| 52 Sk2x operator +(const Sk2x& o) const { return this->add(o); } |
| 53 Sk2x operator -(const Sk2x& o) const { return this->subtract(o); } |
| 54 Sk2x operator *(const Sk2x& o) const { return this->multiply(o); } |
| 55 |
| 56 Sk2x& operator +=(const Sk2x& o) { return (*this = *this + o); } |
| 57 Sk2x& operator -=(const Sk2x& o) { return (*this = *this - o); } |
| 58 Sk2x& operator *=(const Sk2x& o) { return (*this = *this * o); } |
| 59 |
| 52 Sk2x rsqrt() const; // Approximate 1/this->sqrt(). | 60 Sk2x rsqrt() const; // Approximate 1/this->sqrt(). |
| 53 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le
ss precise. | 61 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le
ss precise. |
| 54 | 62 |
| 55 static Sk2x Min(const Sk2x&, const Sk2x&); | 63 static Sk2x Min(const Sk2x&, const Sk2x&); |
| 56 static Sk2x Max(const Sk2x&, const Sk2x&); | 64 static Sk2x Max(const Sk2x&, const Sk2x&); |
| 57 | 65 |
| 58 private: | 66 private: |
| 59 #define SK2X_PRIVATE 1 | 67 #define SK2X_PRIVATE 1 |
| 60 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 68 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 61 #include "../opts/Sk2x_sse.h" | 69 #include "../opts/Sk2x_sse.h" |
| 62 #elif defined(__ARM_NEON__) | 70 #elif defined(__ARM_NEON__) |
| 63 #include "../opts/Sk2x_neon.h" | 71 #include "../opts/Sk2x_neon.h" |
| 64 #else | 72 #else |
| 65 #include "../opts/Sk2x_none.h" | 73 #include "../opts/Sk2x_none.h" |
| 66 #endif | 74 #endif |
| 67 #undef SK2X_PRIVATE | 75 #undef SK2X_PRIVATE |
| 68 }; | 76 }; |
| 69 | 77 |
| 70 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 78 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 71 #include "../opts/Sk2x_sse.h" | 79 #include "../opts/Sk2x_sse.h" |
| 72 #elif defined(__ARM_NEON__) | 80 #elif defined(__ARM_NEON__) |
| 73 #include "../opts/Sk2x_neon.h" | 81 #include "../opts/Sk2x_neon.h" |
| 74 #else | 82 #else |
| 75 #include "../opts/Sk2x_none.h" | 83 #include "../opts/Sk2x_none.h" |
| 76 #endif | 84 #endif |
| 77 | 85 |
| 78 #endif//Sk2x_DEFINED | 86 #endif//Sk2x_DEFINED |
| OLD | NEW |