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

◆ bit_set

auto eve::bit_set = functor<bit_set_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto bit_set(integral_value auto x, integral_value auto n) noexcept; // 1
// Lanes masking
constexpr auto bit_set[conditional_expr auto c](integral_value, auto x integral_value auto n) noexcept; // 2
constexpr auto bit_set[logical_value auto m](integral_value auto x, integral_value auto n) noexcept; // 2
}
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 bit_set
strict_elementwise_callable object setting to 1 the ith bit of each element.
Definition bit_set.hpp:68
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The value of the parameter is returned with the ith bit set to 1. If the index is out of range the call will assert.
  2. The operation is performed conditionnaly.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide pi = {1, 3, 7, 15, 31, 63, 127, 255};
std::cout << "<- pi = " << pi << '\n';
std::cout << "-> bit_set(pi, 1) = " << eve::bit_set(pi, 1) << '\n';
std::cout << "-> bit_set(pi, 2) = " << eve::bit_set(pi, 2) << '\n';
std::cout << "-> bit_set(pi, 3) = " << eve::bit_set(pi, 3) << '\n';
std::cout << "-> bit_set(pi, 4) = " << eve::bit_set(pi, 4) << '\n';
std::cout << "-> bit_set(pi, 8) = " << eve::bit_set(pi, 8) << '\n';
std::cout << "-> bit_set[pi > 15](pi, 1) = " << eve::bit_set[pi > 15](pi, 1) << '\n';
std::cout << "-> bit_set[pi > 15](pi, 2) = " << eve::bit_set[pi > 15](pi, 2) << '\n';
std::cout << "-> bit_set[pi > 15](pi, 3) = " << eve::bit_set[pi > 15](pi, 3) << '\n';
std::cout << "-> bit_set[pi > 15](pi, 4) = " << eve::bit_set[pi > 15](pi, 4) << '\n';
std::cout << "-> bit_set[pi > 15](pi, 8) = " << eve::bit_set[pi > 15](pi, 8) << '\n';
}
constexpr auto pi
Callable object computing the constant .
Definition pi.hpp:77
Wrapper for SIMD registers.
Definition wide.hpp:86