E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
bit_swap_adjacent
auto eve::bit_swap_adjacent =
functor
<bit_swap_adjacent_t>
inline
constexpr
Header file
#include <eve/module/core.hpp>
Callable Signatures
namespace
eve
{
// Regular overload
constexpr
auto
bit_swap_adjacent
(
unsigned_value
auto
x,
integral_scalar_value
auto
n)
noexcept
;
// 1
// Lanes masking
constexpr
auto
bit_swap_adjacent
[
conditional_expr
auto
c](
unsigned_value
auto
x,
integral_scalar_value
auto
n)
noexcept
;
// 2
constexpr
auto
bit_swap_adjacent
[
logical_value
auto
m](
unsigned_value
auto
x,
integral_scalar_value
auto
n)
noexcept
;
// 2
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::integral_scalar_value
Specify that a type represents an integral scalar value. The concept integral_scalar_value<T> is sati...
Definition
vectorizable.hpp:28
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:134
eve::unsigned_value
The concept unsigned_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition
value.hpp:84
eve::bit_swap_adjacent
constexpr auto bit_swap_adjacent
strict_elementwise_callable object swapping adjacent groups of n bits.
Definition
bit_swap_adjacent.hpp:72
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
:
argument
.
n
: size of the groups of bits to be swapped. n MUST be a power of 2 else the call will assert.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
Return
x
with pairs of contiguous groups of N bits swapped in each element.
If n is greater or equal to sizeof(x)*8 0 is returned.
If n is equal to 0 x is returned.
The operation is performed conditionnaly
.
Example
// revision 2
#include <eve/module/core.hpp>
#include <iostream>
int
main()
{
eve::wide
wu0{0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
std::cout <<
"-> bit_swap_adjacent(wu0, 2) = "
<<
eve::bit_swap_adjacent
(wu0, 2) <<
"\n"
;
std::cout <<
"-> bit_swap_adjacent[ignore_last(2)](wu0, 2) = "
<<
eve::bit_swap_adjacent
[
eve::ignore_last
(2)](wu0, 2) <<
"\n"
;
std::cout <<
"-> bit_swap_adjacent[wu0 != 2u](wu0, 2) = "
<<
eve::bit_swap_adjacent
[wu0 != 2u](wu0, 2) <<
"\n"
;
std::cout <<
"-> bit_swap_adjacent(wu0, 2) = "
<<
eve::bit_swap_adjacent
(wu0, 2) <<
"\n"
;
}
eve::ignore_last
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition
conditional.hpp:353
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
Semantic Modifiers
eve