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

Unified Diff: tests/Float16Test.cpp

Issue 1686543003: skeleton for float <-> half optimized procs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bench Created 4 years, 10 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/SkOpts.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/Float16Test.cpp
diff --git a/tests/Float16Test.cpp b/tests/Float16Test.cpp
index 0a2c3d5d6b62b09fc523aeb633655b4f124bb8ac..f437268c79faedacab7f02df01ebd2d33c917cff 100644
--- a/tests/Float16Test.cpp
+++ b/tests/Float16Test.cpp
@@ -8,6 +8,7 @@
#include "Test.h"
#include "SkColor.h"
#include "SkHalf.h"
+#include "SkOpts.h"
#include "SkPixmap.h"
static bool eq_within_half_float(float a, float b) {
@@ -50,3 +51,16 @@ DEF_TEST(color_half_float, reporter) {
}
}
}
+
+DEF_TEST(float_to_half, reporter) {
+ const float fs[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 };
+ const uint16_t hs[] = { 0x3c00, 0x4000, 0x4200, 0x4400, 0x4500, 0x4600, 0x4700 };
+
+ uint16_t hscratch[7];
+ SkOpts::float_to_half(hscratch, fs, 7);
+ REPORTER_ASSERT(reporter, 0 == memcmp(hscratch, hs, sizeof(hs)));
+
+ float fscratch[7];
+ SkOpts::half_to_float(fscratch, hs, 7);
+ REPORTER_ASSERT(reporter, 0 == memcmp(fscratch, fs, sizeof(fs)));
+}
« no previous file with comments | « src/core/SkOpts.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698