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_neon_DEFINED | 8 #ifndef SkNx_neon_DEFINED |
9 #define SkNx_neon_DEFINED | 9 #define SkNx_neon_DEFINED |
10 | 10 |
| 11 namespace { // See SkNx.h |
| 12 |
11 // Well, this is absurd. The shifts require compile-time constant arguments. | 13 // Well, this is absurd. The shifts require compile-time constant arguments. |
12 | 14 |
13 #define SHIFT8(op, v, bits) switch(bits) { \ | 15 #define SHIFT8(op, v, bits) switch(bits) { \ |
14 case 1: return op(v, 1); case 2: return op(v, 2); case 3: return op(v
, 3); \ | 16 case 1: return op(v, 1); case 2: return op(v, 2); case 3: return op(v
, 3); \ |
15 case 4: return op(v, 4); case 5: return op(v, 5); case 6: return op(v
, 6); \ | 17 case 4: return op(v, 4); case 5: return op(v, 5); case 6: return op(v
, 6); \ |
16 case 7: return op(v, 7); \ | 18 case 7: return op(v, 7); \ |
17 } return fVec | 19 } return fVec |
18 | 20 |
19 #define SHIFT16(op, v, bits) if (bits < 8) { SHIFT8(op, v, bits); } switch(bits)
{ \ | 21 #define SHIFT16(op, v, bits) if (bits < 8) { SHIFT8(op, v, bits); } switch(bits)
{ \ |
20 case 8: return op(v, 8); case 9: return op(v
, 9); \ | 22 case 8: return op(v, 8); case 9: return op(v
, 9); \ |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 return vbslq_u8(fVec, t.fVec, e.fVec); | 376 return vbslq_u8(fVec, t.fVec, e.fVec); |
375 } | 377 } |
376 | 378 |
377 uint8x16_t fVec; | 379 uint8x16_t fVec; |
378 }; | 380 }; |
379 | 381 |
380 #undef SHIFT32 | 382 #undef SHIFT32 |
381 #undef SHIFT16 | 383 #undef SHIFT16 |
382 #undef SHIFT8 | 384 #undef SHIFT8 |
383 | 385 |
| 386 } // namespace |
| 387 |
384 #endif//SkNx_neon_DEFINED | 388 #endif//SkNx_neon_DEFINED |
OLD | NEW |