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_cardinal = (force_cardinal_key = eve::fixed<N>{})

Variable Documentation

◆ force_cardinal

template<int N>
auto eve::algo::force_cardinal = (force_cardinal_key = eve::fixed<N>{})
inlineconstexpr
Header file #include <eve/module/algo.hpp>
namespace eve::algo
{
template<int N> inline constexpr auto force_cardinal = eve_implementation_defined;
}
constexpr auto force_cardinal
Definition traits.hpp:213
Template Parameters
NLanes handled at once.

Sets the cardinal of the loop, the number of lanes handled at once, to N. By default the cardinal comes from the types the range carries and from whether frequency scaling is allowed. Interacting with hand-written register code requires the trait, the register width being fixed there.

#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, allow_frequency_scaling