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

◆ bit_width

auto eve::bit_width = functor<bit_width_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto bit_width(unsigned_value auto x) noexcept; // 1
// Lanes masking
constexpr auto bit_width[conditional_expr auto c](unsigned_value auto x) noexcept; // 2
constexpr auto bit_width[logical_value auto m](unsigned_value auto x) noexcept; // 2
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept unsigned_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:84
constexpr auto bit_width
elementwise_callable object Computing elementwise the number of bits needed to store the parameter.
Definition bit_width.hpp:69
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. The value of number of bits needed to store the value x, i.e. \(1+\lfloor\log2(x)\rfloor\) is returned.
  2. The operation is performed conditionnaly.

Example

// revision 0
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide wu0{0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u};
std::cout << "<- wu0 = " << wu0 << "\n";
std::cout << "-> bit_width(wu0) = " << eve::bit_width(wu0) << "\n";
std::cout << "-> bit_width[ignore_last(2)](wu0) = " << eve::bit_width[eve::ignore_last(2)](wu0) << "\n";
std::cout << "-> bit_width[wu0 != 0](wu0) = " << eve::bit_width[wu0 != 0](wu0) << "\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