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 "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkEndian.h" | 9 #include "SkEndian.h" |
10 #include "SkFloatBits.h" | 10 #include "SkFloatBits.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 unittest_fastfloat(reporter); | 555 unittest_fastfloat(reporter); |
556 unittest_isfinite(reporter); | 556 unittest_isfinite(reporter); |
557 unittest_half(reporter); | 557 unittest_half(reporter); |
558 test_rsqrt(reporter); | 558 test_rsqrt(reporter); |
559 | 559 |
560 for (i = 0; i < 10000; i++) { | 560 for (i = 0; i < 10000; i++) { |
561 SkFixed numer = rand.nextS(); | 561 SkFixed numer = rand.nextS(); |
562 SkFixed denom = rand.nextS(); | 562 SkFixed denom = rand.nextS(); |
563 SkFixed result = SkFixedDiv(numer, denom); | 563 SkFixed result = SkFixedDiv(numer, denom); |
564 int64_t check = ((int64_t)numer << 16) / denom; | 564 int64_t check = SkLeftShift((int64_t)numer, 16) / denom; |
565 | 565 |
566 (void)SkCLZ(numer); | 566 (void)SkCLZ(numer); |
567 (void)SkCLZ(denom); | 567 (void)SkCLZ(denom); |
568 | 568 |
569 REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32); | 569 REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32); |
570 if (check > SK_MaxS32) { | 570 if (check > SK_MaxS32) { |
571 check = SK_MaxS32; | 571 check = SK_MaxS32; |
572 } else if (check < -SK_MaxS32) { | 572 } else if (check < -SK_MaxS32) { |
573 check = SK_MinS32; | 573 check = SK_MinS32; |
574 } | 574 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 test_divmod<int16_t>(r); | 689 test_divmod<int16_t>(r); |
690 } | 690 } |
691 | 691 |
692 DEF_TEST(divmod_s32, r) { | 692 DEF_TEST(divmod_s32, r) { |
693 test_divmod<int32_t>(r); | 693 test_divmod<int32_t>(r); |
694 } | 694 } |
695 | 695 |
696 DEF_TEST(divmod_s64, r) { | 696 DEF_TEST(divmod_s64, r) { |
697 test_divmod<int64_t>(r); | 697 test_divmod<int64_t>(r); |
698 } | 698 } |
OLD | NEW |