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

◆ bit_swap_pairs

auto eve::bit_swap_pairs = functor<bit_swap_pairs_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto bit_swap_pairs(integral_value auto x,
integral_value auto i0, integral_value auto i1) noexcept; // 1
// Lanes masking
constexpr auto bit_swap_pairs[conditional_expr auto c](integral_value auto x,
integral_value auto i0, integral_value auto i1) noexcept; // 2
constexpr auto bit_swap_pairs[logical_value auto m](integral_value auto x,
integral_value i0, integral_value auto i1) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept integral_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:51
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
constexpr auto bit_swap_pairs
strict_elementwise_callable object swapping pairs.
Definition bit_swap_pairs.hpp:78
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. Return x with bit i0 and i1 swapped in each element of x. Assert if i0 or i1 are out of range.
  2. The operation is performed conditionnaly.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide<int, eve::fixed<4>> wi0{2, 4, 9, 5};
eve::wide<int, eve::fixed<4>> wi1{1, 3, 3, 3};
eve::wide<int, eve::fixed<4>> wi2{0, 2, 1, 2};
eve::wide<int, eve::fixed<4>> wi3{0, -2, -1, 7};
std::cout << std::showbase << std::hex;
std::cout << "<- wi0 = " << wi0 << "\n";
std::cout << "<- wi1 = " << wi1 << "\n";
std::cout << "<- wi2 = " << wi2 << "\n";
std::cout << "-> bit_swap_pairs(wi0, wi1, wi2) = " << eve::bit_swap_pairs(wi0, wi1, wi2) << "\n";
std::cout << "-> bit_swap_pairs[ignore_last(2)](wi0, wi1, wi2) = " << eve::bit_swap_pairs[eve::ignore_last(2)](wi0, wi1, wi2) << "\n";
std::cout << "-> bit_swap_pairs[wi3 > 0](wi0, wi1, wi3) = " << eve::bit_swap_pairs[wi3 >= 0](wi0, wi1, wi3) << "\n";
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:332
Wrapper for SIMD registers.
Definition wide.hpp:70