E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
bit_reverse
auto eve::bit_reverse =
functor
<bit_reverse_t>
inline
constexpr
Header file
#include <eve/module/core.hpp>
Callable Signatures
namespace
eve
{
// Regular overloads
constexpr
auto
bit_reverse
(
unsigned_value
auto
x)
noexcept
;
// 1
constexpr
auto
bit_reverse
(
unsigned_value
auto
x
integral_scalar_value
n)
noexcept
;
// 2
// Lanes masking
constexpr
auto
bit_reverse
[
conditional_expr
auto
c](
/*any of the above overloads*/
)
noexcept
;
// 3
constexpr
auto
bit_reverse
[
logical_value
auto
m](
/*any of the above overloads*/
)
noexcept
;
// 3
}
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_reverse
constexpr auto bit_reverse
strict_elementwise_callable object reversing the bit order.
Definition
bit_reverse.hpp:84
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
:
argument
.
n
: n scalar delimiting the band to be reversed at both ends of x.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
The values of the of the parameter are returned with bits in reversed order.
if n is present :
if n == 0 the call returns x
if 2*n is greater or equal to the size of the element type of
x
, the call is identical to
reverse(x)
.
otherwise the first n bits and the last n bits of each element of x are swapped in reverse order and the central remaining bits are unchanged.
The operation is performed conditionnaly
.
Example
// revision 1
#include <eve/module/core.hpp>
#include <iostream>
int
main()
{
eve::wide
wu0{0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
std::cout <<
"<- wu0 = "
<< wu0 <<
"\n"
;
std::cout <<
"-> bit_reverse(wu0) = "
<<
eve::bit_reverse
(wu0) <<
"\n"
;
std::cout <<
"-> bit_reverse(wu0, 3) = "
<<
eve::bit_reverse
(wu0, 3) <<
"\n"
;
std::cout <<
"-> bit_reverse[ignore_last(2)](wu0) = "
<<
eve::bit_reverse
[
eve::ignore_last
(2)](wu0) <<
"\n"
;
std::cout <<
"-> bit_reverse[wu0 != 2u](wu0) = "
<<
eve::bit_reverse
[wu0 != 2u](wu0) <<
"\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
eve