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

◆ bit_select

auto eve::bit_select = functor<bit_select_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto bit_select((auto value auto m, auto value x, auto value y) noexcept;
}
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto bit_select
strict_elementwise_callable object selecting bits from a mask and two entries.
Definition bit_select.hpp:69
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value The value of the selected bits is returned.

  • In a short way (omitting casting details to bring all bit sizes of the parameters equal), it means that the result is composed of the bits of x for which the corresponding bit of m is set and the bits of y for which the corresponding bit of m is unset.
  • If x or y is an simd value, the type of the result has the element type of the common type of x and y and the maximum of the cardinals of m and this type, otherwise it is the type of x.

Example

// revision 2
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide wl = {2, -3, 0, 1 << 10};
eve::wide wi = {3, -2, 4, 2 };
eve::wide wu = {0u, 1023u, 1u, ~0u << 8};
std::cout << "<- wl = " << wl << "\n";
std::cout << "<- wi = " << wi << "\n";
std::cout << "<- wu = " << wu << "\n";
std::cout << "-> bit_select(wl, wu, 0) = " << eve::bit_select(wl, wu, ~0u) << "\n";
std::cout << "-> bit_select(wl, wi, 0) = " << eve::bit_select(wl, wi, -1) << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:70