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

Unified Diff: src/core/Sk4x.h

Issue 1048593002: Refactor Sk2x<T> + Sk4x<T> into SkNf<N,T> and SkNi<N,T> (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: This is actually faster 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 | « src/core/Sk2x.h ('k') | src/core/SkGeometry.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
deleted file mode 100644
index c72583abcd2e2c3cd2c41bdd6f6ad6a49aaef9aa..0000000000000000000000000000000000000000
--- a/src/core/Sk4x.h
+++ /dev/null
@@ -1,123 +0,0 @@
-#ifndef Sk4x_DEFINED
-#define Sk4x_DEFINED
-
-#include "SkTypes.h"
-#include "SkNx.h"
-
-#define SK4X_PREAMBLE 1
- #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
- #include "../opts/Sk4x_sse.h"
- #elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD)
- #include "../opts/Sk4x_neon.h"
- #else
- #include "../opts/Sk4x_none.h"
- #endif
-#undef SK4X_PREAMBLE
-
-template <typename T> class Sk4x;
-typedef Sk4x<float> Sk4f;
-typedef Sk4x<int32_t> Sk4i;
-
-// Some Sk4x methods are implemented only for Sk4f or Sk4i.
-// They might be unavailable, really slow, or just a bad idea.
-// Talk to mtklein if you find yourself unable to link and
-// really need one of those methods.
-
-template <typename T> class Sk4x {
-public:
- Sk4x(); // Uninitialized; use Sk4x(0) for zero.
- explicit Sk4x(T); // Same as Sk4x(T,T,T,T);
- Sk4x(T, T, T, T);
-
- Sk4x(const Sk4x&);
- Sk4x& operator=(const Sk4x&);
-
- static Sk4x Load (const T[4]);
- static Sk4x LoadAligned(const T[4]);
-
- void store (T[4]) const;
- void storeAligned(T[4]) const;
-
- template <typename Dst> Dst reinterpret() const;
- template <typename Dst> Dst cast() const;
-
- bool allTrue() const;
- bool anyTrue() const;
-
- Sk4x bitNot() const;
- Sk4x bitAnd(const Sk4x&) const;
- Sk4x bitOr(const Sk4x&) const;
- // TODO: Sk4x bitAndNot(const Sk4x&) const; is efficient in SSE.
- Sk4x add(const Sk4x&) const;
- Sk4x subtract(const Sk4x&) const;
- 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 negate() const { return Sk4x((T)0) - *this; }
- Sk4x operator -() const { return this->negate(); }
-
- Sk4x rsqrt() const; // Approximate reciprocal sqrt().
- Sk4x sqrt() const; // this->multiply(this->rsqrt()) may be faster, but less precise.
-
- Sk4i equal(const Sk4x&) const;
- Sk4i notEqual(const Sk4x&) const;
- Sk4i lessThan(const Sk4x&) const;
- Sk4i greaterThan(const Sk4x&) const;
- 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);
-
- // Swizzles, where this == abcd.
- Sk4x aacc() const;
- Sk4x bbdd() const;
- Sk4x badc() const;
-
-private:
- // It's handy to have Sk4f and Sk4i be mutual friends.
- template <typename S> friend class Sk4x;
-
-#define SK4X_PRIVATE 1
- #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
- #include "../opts/Sk4x_sse.h"
- #elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD)
- #include "../opts/Sk4x_neon.h"
- #else
- #include "../opts/Sk4x_none.h"
- #endif
-#undef SK4X_PRIVATE
-};
-
-#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 && !defined(SKNX_NO_SIMD)
- #include "../opts/Sk4x_sse.h"
-#elif defined(SK_ARM_HAS_NEON) && !defined(SKNX_NO_SIMD)
- #include "../opts/Sk4x_neon.h"
-#else
- #include "../opts/Sk4x_none.h"
-#endif
-
-#endif//Sk4x_DEFINED
« no previous file with comments | « src/core/Sk2x.h ('k') | src/core/SkGeometry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698