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

Unified Diff: src/core/SkNx.h

Issue 1133933004: add Min to SkNi, specialized for u8 and u16 on SSE and NEON (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixes Created 5 years, 7 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 | src/opts/SkNx_neon.h » ('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 ed939c3e4feb9824a7a3b011166df5b9c459cd4b..af7194840a4f028c8bc9dca0c339349a4a79866a 100644
--- a/src/core/SkNx.h
+++ b/src/core/SkNx.h
@@ -68,7 +68,11 @@ public:
SkNi operator << (int bits) const { return SkNi(fLo << bits, fHi << bits); }
SkNi operator >> (int bits) const { return SkNi(fLo >> bits, fHi >> bits); }
- // TODO: comparisons, min, max?
+ static SkNi Min(const SkNi& a, const SkNi& b) {
+ return SkNi(SkNi<N/2, T>::Min(a.fLo, b.fLo), SkNi<N/2, T>::Min(a.fHi, b.fHi));
+ }
+
+ // TODO: comparisons, max?
template <int k> T kth() const {
SkASSERT(0 <= k && k < N);
@@ -183,6 +187,8 @@ public:
SkNi operator << (int bits) const { return SkNi(fVal << bits); }
SkNi operator >> (int bits) const { return SkNi(fVal >> bits); }
+ static SkNi Min(const SkNi& a, const SkNi& b) { return SkNi(SkTMin(a.fVal, b.fVal)); }
+
template <int k> T kth() const {
SkASSERT(0 == k);
return fVal;
« no previous file with comments | « no previous file | src/opts/SkNx_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698