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

Unified Diff: src/core/Sk4x.h

Issue 1024633003: operator overloads for Sk4x, use them all where possible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: weird, msvc doesnt like operator~() 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/PMFloatTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/Sk4x.h
diff --git a/src/core/Sk4x.h b/src/core/Sk4x.h
index d280c1b3783a03a1217c09bf63c78ec8967345cc..f006d70e24c26850a98b490bc0eb1550bd88dfe3 100644
--- a/src/core/Sk4x.h
+++ b/src/core/Sk4x.h
@@ -52,6 +52,22 @@ public:
Sk4x multiply(const Sk4x&) const;
Sk4x divide(const Sk4x&) const;
+ // TODO: why doesn't MSVC like operator~() ?
+ //Sk4x operator ~() const { return this->bitNot(); }
+ Sk4x operator &(const Sk4x& o) const { return this->bitAnd(o); }
+ Sk4x operator |(const Sk4x& o) const { return this->bitOr (o); }
+ Sk4x operator +(const Sk4x& o) const { return this->add(o); }
+ Sk4x operator -(const Sk4x& o) const { return this->subtract(o); }
+ Sk4x operator *(const Sk4x& o) const { return this->multiply(o); }
+ Sk4x operator /(const Sk4x& o) const { return this->divide(o); }
+
+ Sk4x& operator &=(const Sk4x& o) { return (*this = *this & o); }
+ Sk4x& operator |=(const Sk4x& o) { return (*this = *this | o); }
+ Sk4x& operator +=(const Sk4x& o) { return (*this = *this + o); }
+ Sk4x& operator -=(const Sk4x& o) { return (*this = *this - o); }
+ Sk4x& operator *=(const Sk4x& o) { return (*this = *this * o); }
+ Sk4x& operator /=(const Sk4x& o) { return (*this = *this / o); }
+
Sk4x rsqrt() const; // Approximate reciprocal sqrt().
Sk4x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but less precise.
@@ -62,6 +78,13 @@ public:
Sk4i lessThanEqual(const Sk4x&) const;
Sk4i greaterThanEqual(const Sk4x&) const;
+ Sk4i operator ==(const Sk4x& o) const { return this->equal(o); }
+ Sk4i operator !=(const Sk4x& o) const { return this->notEqual(o); }
+ Sk4i operator <(const Sk4x& o) const { return this->lessThan(o); }
+ Sk4i operator >(const Sk4x& o) const { return this->greaterThan(o); }
+ Sk4i operator <=(const Sk4x& o) const { return this->lessThanEqual(o); }
+ Sk4i operator >=(const Sk4x& o) const { return this->greaterThanEqual(o); }
+
static Sk4x Min(const Sk4x& a, const Sk4x& b);
static Sk4x Max(const Sk4x& a, const Sk4x& b);
« no previous file with comments | « no previous file | tests/PMFloatTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698