Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: src/core/Sk2x.h

Issue 1027783002: Sk2x/Sk4x: add negate(), operator -() (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/Sk4x.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 Sk2x multiply(const Sk2x&) const; 51 Sk2x multiply(const Sk2x&) const;
52 52
53 Sk2x operator +(const Sk2x& o) const { return this->add(o); } 53 Sk2x operator +(const Sk2x& o) const { return this->add(o); }
54 Sk2x operator -(const Sk2x& o) const { return this->subtract(o); } 54 Sk2x operator -(const Sk2x& o) const { return this->subtract(o); }
55 Sk2x operator *(const Sk2x& o) const { return this->multiply(o); } 55 Sk2x operator *(const Sk2x& o) const { return this->multiply(o); }
56 56
57 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); } 58 Sk2x& operator -=(const Sk2x& o) { return (*this = *this - o); }
59 Sk2x& operator *=(const Sk2x& o) { return (*this = *this * o); } 59 Sk2x& operator *=(const Sk2x& o) { return (*this = *this * o); }
60 60
61 Sk2x negate() const { return Sk2x(0) - *this; }
62 Sk2x operator -() const { return this->negate(); }
63
61 Sk2x rsqrt() const; // Approximate 1/this->sqrt(). 64 Sk2x rsqrt() const; // Approximate 1/this->sqrt().
62 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise. 65 Sk2x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but le ss precise.
63 66
64 static Sk2x Min(const Sk2x&, const Sk2x&); 67 static Sk2x Min(const Sk2x&, const Sk2x&);
65 static Sk2x Max(const Sk2x&, const Sk2x&); 68 static Sk2x Max(const Sk2x&, const Sk2x&);
66 69
67 private: 70 private:
68 #define SK2X_PRIVATE 1 71 #define SK2X_PRIVATE 1
69 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD) 72 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
70 #include "../opts/Sk2x_sse.h" 73 #include "../opts/Sk2x_sse.h"
71 #elif defined(__ARM_NEON__) && !defined(SKNX_NO_SIMD) 74 #elif defined(__ARM_NEON__) && !defined(SKNX_NO_SIMD)
72 #include "../opts/Sk2x_neon.h" 75 #include "../opts/Sk2x_neon.h"
73 #else 76 #else
74 #include "../opts/Sk2x_none.h" 77 #include "../opts/Sk2x_none.h"
75 #endif 78 #endif
76 #undef SK2X_PRIVATE 79 #undef SK2X_PRIVATE
77 }; 80 };
78 81
79 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD) 82 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
80 #include "../opts/Sk2x_sse.h" 83 #include "../opts/Sk2x_sse.h"
81 #elif defined(__ARM_NEON__) && !defined(SKNX_NO_SIMD) 84 #elif defined(__ARM_NEON__) && !defined(SKNX_NO_SIMD)
82 #include "../opts/Sk2x_neon.h" 85 #include "../opts/Sk2x_neon.h"
83 #else 86 #else
84 #include "../opts/Sk2x_none.h" 87 #include "../opts/Sk2x_none.h"
85 #endif 88 #endif
86 89
87 #endif//Sk2x_DEFINED 90 #endif//Sk2x_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/Sk4x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698