* @brief Return lanes from @c b if @c cond is set, else @c a. */
| 682 | * @brief Return lanes from @c b if @c cond is set, else @c a. |
| 683 | */ |
| 684 | ASTCENC_SIMD_INLINE vint4 select(vint4 a, vint4 b, vmask4 cond) |
| 685 | { |
| 686 | __m128i condi = _mm_castps_si128(cond.m); |
| 687 | |
| 688 | #if ASTCENC_SSE >= 41 |
| 689 | return vint4(_mm_blendv_epi8(a.m, b.m, condi)); |
| 690 | #else |
| 691 | return vint4(_mm_or_si128(_mm_and_si128(condi, b.m), _mm_andnot_si128(condi, a.m))); |
| 692 | #endif |
| 693 | } |
| 694 | |
| 695 | // ============================================================================ |
| 696 | // vfloat4 operators and functions |