Browse Source

Add simd::movemask().

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
c21fb4e9e9
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      include/simd/vector.hpp

+ 14
- 0
include/simd/vector.hpp View File

@@ -158,6 +158,20 @@ inline Vector<float, 4> andnot(const Vector<float, 4> &a, const Vector<float, 4>
return Vector<float, 4>(_mm_andnot_ps(a.v, b.v));
}

/** Returns an integer with each bit corresponding to the most significant bit of each element.
For example, `movemask(float_4::mask())` returns 0xf.
*/
inline int movemask(const Vector<float, 4> &a) {
return _mm_movemask_ps(a.v);
}

/** Returns an integer with each bit corresponding to the most significant bit of each byte.
For example, `movemask(int32_4::mask())` returns 0xffff.
*/
inline int movemask(const Vector<int32_t, 4> &a) {
return _mm_movemask_epi8(a.v);
}


// Operator overloads



Loading…
Cancel
Save