E.V.E
v2023.02.15
Loading...
Searching...
No Matches

Detailed Description

Overrides the cardinal an algorithm iterates with.

Variables

template<int N>
constexpr auto eve::algo::force_width = (force_width_key = eve::lanes_t<N>{})
 A trait that overrides all other width selection and just says to use a certain one. The main use-case for this is ease of interaction with native register code.

Variable Documentation

◆ force_width

template<int N>
auto eve::algo::force_width = (force_width_key = eve::lanes_t<N>{})
inlineconstexpr

A trait that overrides all other width selection and just says to use a certain one. The main use-case for this is ease of interaction with native register code.

#include <eve/module/core.hpp>
#include <eve/module/algo.hpp>
#include <string>
#include <span>
#ifdef __SSSE3__
void remove_spaces(std::string& s)
{
// eve only supports std::int8_t and std::uint8_t, not char.
std::span s_bytes{reinterpret_cast<std::uint8_t*>(s.data()), s.size()};
s_bytes,[](u8x16 v) -> eve::logical<u8x16> {
// A simd is_space we took from @aqrit
__m128i lut = _mm_setr_epi8(' ', 0, 0, 0,
0, 0, 0, 0,
0, '\t', '\n', 0,
0, '\r', 0, 0);
return v == u8x16{_mm_shuffle_epi8(lut, v)};
});
auto offset = end - s_bytes.begin();
s.erase(s.begin() + offset, s.end());
}
#endif // __SSSE3__
See also
consider_types if maybe using some extra type is the reason you want to change width.