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

◆ force_cardinal

template<int N>
auto eve::algo::force_cardinal = (force_cardinal_key = eve::fixed<N>{})
inlineconstexpr

#include <eve/module/algo/algo/traits.hpp>

#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 cardinal.