| OLD | NEW |
| 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 "float.h" | 8 #include "float.h" |
| 9 | 9 |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 { | 528 { |
| 529 SkFixed result = SkFixedDiv(100, 100); | 529 SkFixed result = SkFixedDiv(100, 100); |
| 530 REPORTER_ASSERT(reporter, result == SK_Fixed1); | 530 REPORTER_ASSERT(reporter, result == SK_Fixed1); |
| 531 result = SkFixedDiv(1, SK_Fixed1); | 531 result = SkFixedDiv(1, SK_Fixed1); |
| 532 REPORTER_ASSERT(reporter, result == 1); | 532 REPORTER_ASSERT(reporter, result == 1); |
| 533 result = SkFixedDiv(10 - 1, SK_Fixed1 * 3); | 533 result = SkFixedDiv(10 - 1, SK_Fixed1 * 3); |
| 534 REPORTER_ASSERT(reporter, result == 3); | 534 REPORTER_ASSERT(reporter, result == 3); |
| 535 } | 535 } |
| 536 | 536 |
| 537 { |
| 538 REPORTER_ASSERT(reporter, (SkFixedRoundToFixed(-SK_Fixed1 * 10) >> 1) ==
-SK_Fixed1 * 5); |
| 539 REPORTER_ASSERT(reporter, (SkFixedFloorToFixed(-SK_Fixed1 * 10) >> 1) ==
-SK_Fixed1 * 5); |
| 540 REPORTER_ASSERT(reporter, (SkFixedCeilToFixed(-SK_Fixed1 * 10) >> 1) ==
-SK_Fixed1 * 5); |
| 541 } |
| 542 |
| 537 unittest_fastfloat(reporter); | 543 unittest_fastfloat(reporter); |
| 538 unittest_isfinite(reporter); | 544 unittest_isfinite(reporter); |
| 539 unittest_half(reporter); | 545 unittest_half(reporter); |
| 540 test_rsqrt(reporter, sk_float_rsqrt); | 546 test_rsqrt(reporter, sk_float_rsqrt); |
| 541 test_rsqrt(reporter, sk_float_rsqrt_portable); | 547 test_rsqrt(reporter, sk_float_rsqrt_portable); |
| 542 | 548 |
| 543 for (i = 0; i < 10000; i++) { | 549 for (i = 0; i < 10000; i++) { |
| 544 SkFixed numer = rand.nextS(); | 550 SkFixed numer = rand.nextS(); |
| 545 SkFixed denom = rand.nextS(); | 551 SkFixed denom = rand.nextS(); |
| 546 SkFixed result = SkFixedDiv(numer, denom); | 552 SkFixed result = SkFixedDiv(numer, denom); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 test_divmod<int16_t>(r); | 678 test_divmod<int16_t>(r); |
| 673 } | 679 } |
| 674 | 680 |
| 675 DEF_TEST(divmod_s32, r) { | 681 DEF_TEST(divmod_s32, r) { |
| 676 test_divmod<int32_t>(r); | 682 test_divmod<int32_t>(r); |
| 677 } | 683 } |
| 678 | 684 |
| 679 DEF_TEST(divmod_s64, r) { | 685 DEF_TEST(divmod_s64, r) { |
| 680 test_divmod<int64_t>(r); | 686 test_divmod<int64_t>(r); |
| 681 } | 687 } |
| OLD | NEW |