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

◆ bit_flip

eve::bit_flip = functor<bit_flip_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto bit_flip(integral_value auto x, integral_value auto i) noexcept; // 1
// Lanes masking
constexpr auto bit_flip[conditional_expr auto c](integral_value auto x, integral_value auto i) noexcept; // 2
constexpr auto bit_flip[logical_value auto m](integral_value auto x, integral_value auto i) 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:134
constexpr auto bit_flip
strict_elementwise_callable object flipping the value the ith bit of each element.
Definition bit_flip.hpp:72
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition translation.hpp:107
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. The value of the parameter is returned with the ith bit flipped. 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_flip(pi, 1) = " << eve::bit_flip(pi, 1) << '\n';
std::cout << "-> bit_flip(pi, 2) = " << eve::bit_flip(pi, 2) << '\n';
std::cout << "-> bit_flip(pi, 3) = " << eve::bit_flip(pi, 3) << '\n';
std::cout << "-> bit_flip(pi, 4) = " << eve::bit_flip(pi, 4) << '\n';
std::cout << "-> bit_flip(pi, 8) = " << eve::bit_flip(pi, 8) << '\n';
std::cout << "-> bit_flip[pi > 15](pi, 1) = " << eve::bit_flip[pi > 15](pi, 1) << '\n';
std::cout << "-> bit_flip[pi > 15](pi, 2) = " << eve::bit_flip[pi > 15](pi, 2) << '\n';
std::cout << "-> bit_flip[pi > 15](pi, 3) = " << eve::bit_flip[pi > 15](pi, 3) << '\n';
std::cout << "-> bit_flip[pi > 15](pi, 4) = " << eve::bit_flip[pi > 15](pi, 4) << '\n';
std::cout << "-> bit_flip[pi > 15](pi, 8) = " << eve::bit_flip[pi > 15](pi, 8) << '\n';
}
Wrapper for SIMD registers.
Definition wide.hpp:94