| 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 #ifndef SkNx_DEFINED | 8 #ifndef SkNx_DEFINED |
| 9 #define SkNx_DEFINED | 9 #define SkNx_DEFINED |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 // The N -> N/2 recursion bottoms out at N == 1, a scalar value. | 105 // The N -> N/2 recursion bottoms out at N == 1, a scalar value. |
| 106 template <typename T> | 106 template <typename T> |
| 107 struct SkNx<1,T> { | 107 struct SkNx<1,T> { |
| 108 T fVal; | 108 T fVal; |
| 109 | 109 |
| 110 SkNx() = default; | 110 SkNx() = default; |
| 111 SkNx(T v) : fVal(v) {} | 111 SkNx(T v) : fVal(v) {} |
| 112 | 112 |
| 113 T operator[](int k) const { | 113 // Android complains against unused parameters, so we guard it |
| 114 T operator[](int SkDEBUGCODE(k)) const { |
| 114 SkASSERT(k == 0); | 115 SkASSERT(k == 0); |
| 115 return fVal; | 116 return fVal; |
| 116 } | 117 } |
| 117 | 118 |
| 118 static SkNx Load(const void* ptr) { | 119 static SkNx Load(const void* ptr) { |
| 119 SkNx v; | 120 SkNx v; |
| 120 memcpy(&v, ptr, sizeof(T)); | 121 memcpy(&v, ptr, sizeof(T)); |
| 121 return v; | 122 return v; |
| 122 } | 123 } |
| 123 void store(void* ptr) const { memcpy(ptr, &fVal, sizeof(T)); } | 124 void store(void* ptr) const { memcpy(ptr, &fVal, sizeof(T)); } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 #include "../opts/SkNx_neon.h" | 302 #include "../opts/SkNx_neon.h" |
| 302 #endif | 303 #endif |
| 303 | 304 |
| 304 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { | 305 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { |
| 305 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); | 306 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); |
| 306 } | 307 } |
| 307 | 308 |
| 308 #undef SI | 309 #undef SI |
| 309 | 310 |
| 310 #endif//SkNx_DEFINED | 311 #endif//SkNx_DEFINED |
| OLD | NEW |