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

Side by Side Diff: tests/MathTest.cpp

Issue 483273003: remove unused SkIntToFloatCast_NoOverflowCheck (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/core/SkFloatBits.cpp ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkEndian.h" 9 #include "SkEndian.h"
10 #include "SkFloatBits.h" 10 #include "SkFloatBits.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 static void test_float_conversions(skiatest::Reporter* reporter, float x) { 257 static void test_float_conversions(skiatest::Reporter* reporter, float x) {
258 test_float_cast(reporter, x); 258 test_float_cast(reporter, x);
259 test_float_floor(reporter, x); 259 test_float_floor(reporter, x);
260 test_float_round(reporter, x); 260 test_float_round(reporter, x);
261 test_float_ceil(reporter, x); 261 test_float_ceil(reporter, x);
262 } 262 }
263 263
264 static void test_int2float(skiatest::Reporter* reporter, int ival) { 264 static void test_int2float(skiatest::Reporter* reporter, int ival) {
265 float x0 = (float)ival; 265 float x0 = (float)ival;
266 float x1 = SkIntToFloatCast(ival); 266 float x1 = SkIntToFloatCast(ival);
267 float x2 = SkIntToFloatCast_NoOverflowCheck(ival);
268 REPORTER_ASSERT(reporter, x0 == x1); 267 REPORTER_ASSERT(reporter, x0 == x1);
269 REPORTER_ASSERT(reporter, x0 == x2);
270 } 268 }
271 269
272 static void unittest_fastfloat(skiatest::Reporter* reporter) { 270 static void unittest_fastfloat(skiatest::Reporter* reporter) {
273 SkRandom rand; 271 SkRandom rand;
274 size_t i; 272 size_t i;
275 273
276 static const float gFloats[] = { 274 static const float gFloats[] = {
277 0.f, 1.f, 0.5f, 0.499999f, 0.5000001f, 1.f/3, 275 0.f, 1.f, 0.5f, 0.499999f, 0.5000001f, 1.f/3,
278 0.000000001f, 1000000000.f, // doesn't overflow 276 0.000000001f, 1000000000.f, // doesn't overflow
279 0.0000000001f, 10000000000.f // does overflow 277 0.0000000001f, 10000000000.f // does overflow
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 test_divmod<int16_t>(r); 594 test_divmod<int16_t>(r);
597 } 595 }
598 596
599 DEF_TEST(divmod_s32, r) { 597 DEF_TEST(divmod_s32, r) {
600 test_divmod<int32_t>(r); 598 test_divmod<int32_t>(r);
601 } 599 }
602 600
603 DEF_TEST(divmod_s64, r) { 601 DEF_TEST(divmod_s64, r) {
604 test_divmod<int64_t>(r); 602 test_divmod<int64_t>(r);
605 } 603 }
OLDNEW
« no previous file with comments | « src/core/SkFloatBits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698