E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
swap_pairs
auto eve::swap_pairs =
functor
<swap_pairs_t>
inline
constexpr
Header file
#include <eve/module/core.hpp>
Callable Signatures
namespace
eve
{
template
<simd_value T, std::ptrdiff_t I0, std::ptrdiff_t I1 >
T
swap_pairs
(T x, index_t<I0> i0, index_t<I1> i1);
eve::swap_pairs
constexpr auto swap_pairs
swap chosen pair of elements.
Definition
swap_pairs.hpp:61
eve
EVE Main Namespace.
Definition
abi.hpp:18
Parameters
x
:
argument
.
i0
: first index
i1
: second index
Return value
Return x with element i0 and i1 swapped.
Example
#include <eve/wide.hpp>
#include <iostream>
#include <eve/module/core.hpp>
using
wide_it =
eve::wide<std::uint32_t, eve::fixed<4>
>;
int
main()
{
wide_it
pi
= {1, 3, 7, 15};
pi =
eve::inc
(pi);
auto
_0 =eve::index_t<0>();
auto
_1 =eve::index_t<1>();
auto
_2 =eve::index_t<2>();
auto
_3 =eve::index_t<3>();
std::cout <<
"---- simd"
<<
'\n'
<<
"<- pi = "
<< pi <<
'\n'
<<
"-> swap_pairs(pi, _0, _3) = "
<<
eve::swap_pairs
(pi, _0, _3) <<
'\n'
<<
"-> swap_pairs(pi, _1, _2) = "
<<
eve::swap_pairs
(pi, _1, _2) <<
'\n'
<<
"-> swap_pairs(pi, _0, _1) = "
<<
eve::swap_pairs
(pi, _0, _1) <<
'\n'
;
return
0;
}
eve::inc
constexpr auto inc
elementwise_callable object returning the input incremented by 1.
Definition
inc.hpp:83
eve::pi
constexpr auto pi
Callable object computing the constant .
Definition
pi.hpp:77
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:89
eve