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

Unified Diff: src/core/SkNx.h

Issue 1650653002: SkNx Load/store: take any pointer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify call sites Created 4 years, 11 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/SkMipMap.cpp ('k') | src/core/SkRect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkNx.h
diff --git a/src/core/SkNx.h b/src/core/SkNx.h
index 2bbd495ce50bca907407b87cc6bd315876e03a96..4cb15dffe725efb928a24fb0344c253fe99f064e 100644
--- a/src/core/SkNx.h
+++ b/src/core/SkNx.h
@@ -32,7 +32,8 @@ public:
SkNx() {}
SkNx(const SkNx<N/2, T>& lo, const SkNx<N/2, T>& hi) : fLo(lo), fHi(hi) {}
SkNx(T val) : fLo(val), fHi(val) {}
- static SkNx Load(const T vals[N]) {
+ static SkNx Load(const void* ptr) {
+ auto vals = (const T*)ptr;
return SkNx(SkNx<N/2,T>::Load(vals), SkNx<N/2,T>::Load(vals+N/2));
}
@@ -43,7 +44,8 @@ public:
T i, T j, T k, T l, T m, T n, T o, T p)
: fLo(a,b,c,d, e,f,g,h), fHi(i,j,k,l, m,n,o,p) { REQUIRE(N==16); }
- void store(T vals[N]) const {
+ void store(void* ptr) const {
+ auto vals = (T*)ptr;
fLo.store(vals);
fHi.store(vals+N/2);
}
@@ -108,9 +110,15 @@ class SkNx<1,T> {
public:
SkNx() {}
SkNx(T val) : fVal(val) {}
- static SkNx Load(const T vals[1]) { return SkNx(vals[0]); }
+ static SkNx Load(const void* ptr) {
+ auto vals = (const T*)ptr;
+ return SkNx(vals[0]);
+ }
- void store(T vals[1]) const { vals[0] = fVal; }
+ void store(void* ptr) const {
+ auto vals = (T*) ptr;
+ vals[0] = fVal;
+ }
SkNx saturatedAdd(const SkNx& o) const {
SkASSERT((T)(~0) > 0); // TODO: support signed T
« no previous file with comments | « src/core/SkMipMap.cpp ('k') | src/core/SkRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698