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

Unified Diff: tests/Float16Test.cpp

Issue 1688233002: new version of SkHalfToFloat_01 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: swap cast order, neon on the brain 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/SkHalf.h ('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 f96d9045673a7b6313e0082e611452d3933f5576..3b13533853ccf97d85e479a7a5232734c1da3933 100644
--- a/tests/Float16Test.cpp
+++ b/tests/Float16Test.cpp
@@ -66,10 +66,23 @@ DEF_TEST(float_to_half, reporter) {
REPORTER_ASSERT(reporter, 0 == memcmp(fscratch, fs, sizeof(fs)));
}
+static uint32_t u(float f) {
+ uint32_t x;
+ memcpy(&x, &f, 4);
+ return x;
+}
+
DEF_TEST(HalfToFloat_01, r) {
for (uint16_t h = 0; h < 0x8000; h++) {
float f = SkHalfToFloat(h);
if (f >= 0 && f <= 1) {
+ float got = SkHalfToFloat_01(h)[0];
+ if (got != f) {
+ SkDebugf("0x%04x -> 0x%08x (%g), want 0x%08x (%g)\n",
+ h,
+ u(got), got,
+ u(f), f);
+ }
REPORTER_ASSERT(r, SkHalfToFloat_01(h)[0] == f);
REPORTER_ASSERT(r, SkFloatToHalf_01(SkHalfToFloat_01(h)) == h);
}
« no previous file with comments | « src/core/SkHalf.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698