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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 test_divmod<int16_t>(r); | 672 test_divmod<int16_t>(r); |
673 } | 673 } |
674 | 674 |
675 DEF_TEST(divmod_s32, r) { | 675 DEF_TEST(divmod_s32, r) { |
676 test_divmod<int32_t>(r); | 676 test_divmod<int32_t>(r); |
677 } | 677 } |
678 | 678 |
679 DEF_TEST(divmod_s64, r) { | 679 DEF_TEST(divmod_s64, r) { |
680 test_divmod<int64_t>(r); | 680 test_divmod<int64_t>(r); |
681 } | 681 } |
| 682 |
| 683 DEF_TEST(SkAlign, r) { |
| 684 int x = 6; |
| 685 REPORTER_ASSERT(r, SkIsAlign2(x)); |
| 686 REPORTER_ASSERT(r, !SkIsAlign4(x)); |
| 687 x = SkAlign4(x); |
| 688 REPORTER_ASSERT(r, SkIsAlign2(x)); |
| 689 REPORTER_ASSERT(r, SkIsAlign4(x)); |
| 690 |
| 691 auto p = (char*)&x; |
| 692 REPORTER_ASSERT(r, SkIsAlign2(p)); |
| 693 REPORTER_ASSERT(r, SkIsAlign4(p)); |
| 694 p += 2; |
| 695 REPORTER_ASSERT(r, SkIsAlign2(p)); |
| 696 REPORTER_ASSERT(r, !SkIsAlign4(p)); |
| 697 p = SkAlign4(p); |
| 698 REPORTER_ASSERT(r, p == (char*)(&x+1)); |
| 699 } |
OLD | NEW |