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

Unified Diff: tests/SkNxTest.cpp

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 | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkNxTest.cpp
diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp
index dec7329c2c2e3e44036fb3d62604d1223f25456a..f8801500db5429cae41048ed8c76c8222beb263d 100644
--- a/tests/SkNxTest.cpp
+++ b/tests/SkNxTest.cpp
@@ -6,6 +6,7 @@
*/
#include "SkNx.h"
+#include "SkRandom.h"
#include "Test.h"
template <int N, typename T>
@@ -130,3 +131,26 @@ DEF_TEST(SkNi, r) {
test_Ni<4, int>(r);
test_Ni<8, int>(r);
}
+
+DEF_TEST(SkNi_min, r) {
+ // Exhaustively check the 8x8 bit space.
+ for (int a = 0; a < (1<<8); a++) {
+ for (int b = 0; b < (1<<8); b++) {
+ REPORTER_ASSERT(r, Sk16b::Min(Sk16b(a), Sk16b(b)).kth<0>() == SkTMin(a, b));
+ }}
+
+ // Exhausting the 16x16 bit space is kind of slow, so only do that in release builds.
+#ifdef SK_DEBUG
+ SkRandom rand;
+ for (int i = 0; i < (1<<16); i++) {
+ uint16_t a = rand.nextU() >> 16,
+ b = rand.nextU() >> 16;
+ REPORTER_ASSERT(r, Sk8h::Min(Sk8h(a), Sk8h(b)).kth<0>() == SkTMin(a, b));
+ }
+#else
+ for (int a = 0; a < (1<<16); a++) {
+ for (int b = 0; b < (1<<16); b++) {
+ REPORTER_ASSERT(r, Sk8h::Min(Sk8h(a), Sk8h(b)).kth<0>() == SkTMin(a, b));
+ }}
+#endif
+}
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698