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

Side by Side Diff: tests/SkNxTest.cpp

Issue 1679343004: Revert of Sk4f: add floor() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Sk4px.h" 8 #include "Sk4px.h"
9 #include "SkNx.h" 9 #include "SkNx.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 DEF_TEST(SkNx_abs, r) { 210 DEF_TEST(SkNx_abs, r) {
211 auto fs = Sk4f(0.0f, -0.0f, 2.0f, -4.0f).abs(); 211 auto fs = Sk4f(0.0f, -0.0f, 2.0f, -4.0f).abs();
212 REPORTER_ASSERT(r, fs.kth<0>() == 0.0f); 212 REPORTER_ASSERT(r, fs.kth<0>() == 0.0f);
213 REPORTER_ASSERT(r, fs.kth<1>() == 0.0f); 213 REPORTER_ASSERT(r, fs.kth<1>() == 0.0f);
214 REPORTER_ASSERT(r, fs.kth<2>() == 2.0f); 214 REPORTER_ASSERT(r, fs.kth<2>() == 2.0f);
215 REPORTER_ASSERT(r, fs.kth<3>() == 4.0f); 215 REPORTER_ASSERT(r, fs.kth<3>() == 4.0f);
216 } 216 }
217 217
218 DEF_TEST(SkNx_floor, r) {
219 auto fs = Sk4f(0.4f, -0.4f, 0.6f, -0.6f).floor();
220 REPORTER_ASSERT(r, fs.kth<0>() == 0.0f);
221 REPORTER_ASSERT(r, fs.kth<1>() == -1.0f);
222 REPORTER_ASSERT(r, fs.kth<2>() == 0.0f);
223 REPORTER_ASSERT(r, fs.kth<3>() == -1.0f);
224 }
225
226 DEF_TEST(SkNx_shuffle, r) { 218 DEF_TEST(SkNx_shuffle, r) {
227 Sk4f f4(0,10,20,30); 219 Sk4f f4(0,10,20,30);
228 220
229 Sk2f f2 = SkNx_shuffle<2,1>(f4); 221 Sk2f f2 = SkNx_shuffle<2,1>(f4);
230 REPORTER_ASSERT(r, f2[0] == 20); 222 REPORTER_ASSERT(r, f2[0] == 20);
231 REPORTER_ASSERT(r, f2[1] == 10); 223 REPORTER_ASSERT(r, f2[1] == 10);
232 224
233 f4 = SkNx_shuffle<0,1,1,0>(f2); 225 f4 = SkNx_shuffle<0,1,1,0>(f2);
234 REPORTER_ASSERT(r, f4[0] == 20); 226 REPORTER_ASSERT(r, f4[0] == 20);
235 REPORTER_ASSERT(r, f4[1] == 10); 227 REPORTER_ASSERT(r, f4[1] == 10);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 (uint16_t)rand.nextU16(), (uint16_t)rand.nextU16(), 260 (uint16_t)rand.nextU16(), (uint16_t)rand.nextU16(),
269 }; 261 };
270 auto u4_0 = Sk4h::Load(s16); 262 auto u4_0 = Sk4h::Load(s16);
271 auto f4 = SkNx_cast<float>(u4_0); 263 auto f4 = SkNx_cast<float>(u4_0);
272 auto u4_1 = SkNx_cast<uint16_t>(f4); 264 auto u4_1 = SkNx_cast<uint16_t>(f4);
273 uint16_t d16[4]; 265 uint16_t d16[4];
274 u4_1.store(d16); 266 u4_1.store(d16);
275 REPORTER_ASSERT(r, !memcmp(s16, d16, sizeof(s16))); 267 REPORTER_ASSERT(r, !memcmp(s16, d16, sizeof(s16)));
276 } 268 }
277 } 269 }
OLDNEW
« 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