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

◆ shl

auto eve::shl = functor<shl_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto shl(integral_value auto x, integral_value auto n) noexcept; // 1
template< auto N >
constexpr auto shl(integral_value auto x, index_t<N> auto n) noexcept; // 2
// Lanes masking
constexpr auto shl[conditional_expr auto c](/* any of the above overloads */) noexcept; // 3
constexpr auto shl[logical_value auto m](/* any of the above overloads */) 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 shl
Computes the arithmetic left shift operation.
Definition shl.hpp:94
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The elementwise arithmetic left shift of the first parameter by the second one is returned. If Nis the size in bits of the element type of x, all elements of n must belong to the interval: ]0, N[ or the result is undefined.
  2. This call allows optimization for architectures that have an intrinsic requiring an immediate parameter
  3. The operation is performed conditionnaly
Note
Although the infix notation with << is supported, the << operator on standard scalar types is the original one and so can not be overloaded on standard floating parameters due to C++ limitations.
Warning
The behavior of this function is undefined if the shift value is out of the range [0, N[, where N is the number of bits of the input type. Use eve::rshl for a relative left shift that accepts negative shift values.

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{0, -4, 1, -1, 2, -2, 3, -3};
std::cout << "<- wi0 = " << wi0 << "\n";
std::cout << "<- wi1 = " << wi1 << "\n";
std::cout << "<- wi2 = " << wi2 << "\n";
std::cout << "-> shl(wi0, wi1) = " << eve::shl(wi0, wi1) << "\n";
std::cout << "-> shl(wi0, index_t<0>()) = " << eve::shl(wi0, eve::index_t<0>()) << "\n";
std::cout << "-> shl[ignore_last(2)](wi0, wi1) = " << eve::shl[eve::ignore_last(2)](wi0, wi1) << "\n";
std::cout << "-> shl[wi2 > 0](wi0, wi2) = " << eve::shl[wi2 > 0](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:86