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

◆ rshr

auto eve::rshr = functor<rshr_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto rshr(integral_value auto x, integral_value auto n) noexcept; // 2
// Lanes masking
constexpr auto rshr[conditional_expr auto c](integral_value auto x, integral_value auto n) noexcept; // 3
constexpr auto rshr[logical_value auto m](integral_value auto x, integral_value auto n) noexcept; // 3
}
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 rshr
Computes the arithmetic right/left shift operation according to shift sign.
Definition rshr.hpp:82
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The value of the arithmetic right/left shift operation according to shift sign is returned. This equivalent to if_else(n>0, shl(x, n), shr(x, -n)). If N is the size in bits of the element type of T, all elements of n must belong to the interval: ]-N, N[ or the result is undefined.
  2. The operation is performed conditionnaly

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide wi0{0, 1, 2, 3, -1, -2, -3, -4};
eve::wide wi1{0, -4, 1, -1, 2, -2, 3, -3};
eve::wide wi2{1024, -4, 1, -1, 2, -2, 3, -3};
std::cout << "<- wi0 = " << wi0 << "\n";
std::cout << "<- wi1 = " << wi1 << "\n";
std::cout << "-> rshr(wi0, wi1) = " << eve::rshr(wi0, wi1) << "\n";
std::cout << "-> rshr[ignore_last(2)](wi0, wi1) = " << eve::rshr[eve::ignore_last(2)](wi0, wi1) << "\n";
std::cout << "-> rshr[wi0 != 0](wi0, wi1) = " << eve::rshr[wi0 != 0](wi0, wi1) << "\n";
std::cout << "-> rshl[wi2 < 32](wi0, wi2) = " << eve::rshr[wi2 < 32](wi0, wi2) << "\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