| OLD | NEW | 
|    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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   46     assert_eq(a+b, 6, 8, 10, 12); |   46     assert_eq(a+b, 6, 8, 10, 12); | 
|   47     assert_eq(a*b, 9, 16, 25, 36); |   47     assert_eq(a*b, 9, 16, 25, 36); | 
|   48     assert_eq(a*b-b, 6, 12, 20, 30); |   48     assert_eq(a*b-b, 6, 12, 20, 30); | 
|   49     assert_eq((a*b).sqrt(), 3, 4, 5, 6); |   49     assert_eq((a*b).sqrt(), 3, 4, 5, 6); | 
|   50     assert_eq(a/b, 1, 1, 1, 1); |   50     assert_eq(a/b, 1, 1, 1, 1); | 
|   51     assert_eq(SkNx<N,float>(0)-a, -3, -4, -5, -6); |   51     assert_eq(SkNx<N,float>(0)-a, -3, -4, -5, -6); | 
|   52  |   52  | 
|   53     SkNx<N,float> fours(4); |   53     SkNx<N,float> fours(4); | 
|   54  |   54  | 
|   55     assert_eq(fours.sqrt(), 2,2,2,2); |   55     assert_eq(fours.sqrt(), 2,2,2,2); | 
|   56     assert_nearly_eq(0.001f, fours.rsqrt0(), 0.5, 0.5, 0.5, 0.5); |   56     assert_nearly_eq(0.001f, fours.rsqrt(), 0.5, 0.5, 0.5, 0.5); | 
|   57     assert_nearly_eq(0.001f, fours.rsqrt1(), 0.5, 0.5, 0.5, 0.5); |  | 
|   58     assert_nearly_eq(0.001f, fours.rsqrt2(), 0.5, 0.5, 0.5, 0.5); |  | 
|   59  |   57  | 
|   60     assert_eq(               fours.      invert(), 0.25, 0.25, 0.25, 0.25); |   58     assert_nearly_eq(0.001f, fours.invert(), 0.25, 0.25, 0.25, 0.25); | 
|   61     assert_nearly_eq(0.001f, fours.approxInvert(), 0.25, 0.25, 0.25, 0.25); |  | 
|   62  |   59  | 
|   63     assert_eq(SkNx<N,float>::Min(a, fours), 3, 4, 4, 4); |   60     assert_eq(SkNx<N,float>::Min(a, fours), 3, 4, 4, 4); | 
|   64     assert_eq(SkNx<N,float>::Max(a, fours), 4, 4, 5, 6); |   61     assert_eq(SkNx<N,float>::Max(a, fours), 4, 4, 5, 6); | 
|   65  |   62  | 
|   66     // Test some comparisons.  This is not exhaustive. |   63     // Test some comparisons.  This is not exhaustive. | 
|   67     REPORTER_ASSERT(r, (a == b).allTrue()); |   64     REPORTER_ASSERT(r, (a == b).allTrue()); | 
|   68     REPORTER_ASSERT(r, (a+b == a*b-b).anyTrue()); |   65     REPORTER_ASSERT(r, (a+b == a*b-b).anyTrue()); | 
|   69     REPORTER_ASSERT(r, !(a+b == a*b-b).allTrue()); |   66     REPORTER_ASSERT(r, !(a+b == a*b-b).allTrue()); | 
|   70     REPORTER_ASSERT(r, !(a+b == a*b).anyTrue()); |   67     REPORTER_ASSERT(r, !(a+b == a*b).anyTrue()); | 
|   71     REPORTER_ASSERT(r, !(a != b).anyTrue()); |   68     REPORTER_ASSERT(r, !(a != b).anyTrue()); | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  284             (uint16_t)rand.nextU16(), (uint16_t)rand.nextU16(), |  281             (uint16_t)rand.nextU16(), (uint16_t)rand.nextU16(), | 
|  285         }; |  282         }; | 
|  286         auto u4_0 = Sk4h::Load(s16); |  283         auto u4_0 = Sk4h::Load(s16); | 
|  287         auto f4 = SkNx_cast<float>(u4_0); |  284         auto f4 = SkNx_cast<float>(u4_0); | 
|  288         auto u4_1 = SkNx_cast<uint16_t>(f4); |  285         auto u4_1 = SkNx_cast<uint16_t>(f4); | 
|  289         uint16_t d16[4]; |  286         uint16_t d16[4]; | 
|  290         u4_1.store(d16); |  287         u4_1.store(d16); | 
|  291         REPORTER_ASSERT(r, !memcmp(s16, d16, sizeof(s16))); |  288         REPORTER_ASSERT(r, !memcmp(s16, d16, sizeof(s16))); | 
|  292     } |  289     } | 
|  293 } |  290 } | 
| OLD | NEW |