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

◆ zero

auto eve::zero = functor<zero_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::plain_value T >
T zero(as<T> x) noexcept;
}
constexpr auto zero
Computes the constant 0.
Definition zero.hpp:78
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

  • x : Type wrapper instance embedding the type of the constant.

Return value

The call eve::zero(as<T>()) is semantically equivalent to T(0).

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
using wide_ft = eve::wide<float>;
using wide_it = eve::wide<std::int16_t>;
template<typename T>
consteval auto constexpr_zero() { return eve::zero(eve::as<T>{}); }
int main()
{
wide_ft wxf;
wide_it wxi;
std::cout << "---- simd" << std::endl
<< "-> zero(as<wide_ft>()) = " << eve::zero(eve::as<wide_ft>()) << std::endl
<< "-> zero(as<wide_it>()) = " << eve::zero(eve::as<wide_it>()) << std::endl
<< "-> zero(as(wxf)) = " << eve::zero(eve::as(wxf)) << std::endl
<< "-> zero(as(wxi)) = " << eve::zero(eve::as(wxi)) << std::endl;
double xf;
std::int16_t xi;
std::cout << "---- scalar" << std::endl
<< "-> zero(as<float>()) = " << eve::zero(eve::as(float())) << std::endl
<< "-> zero(as<std::int16_t>()) = " << eve::zero(eve::as(std::int16_t())) << std::endl
<< "-> zero(as<xf)) = " << eve::zero(eve::as(xf)) << std::endl
<< "-> zero(as<xi)) = " << eve::zero(eve::as(xi)) << std::endl;
std::cout << "-> constexpr zero = " << constexpr_zero<float>() << std::endl;
return 0;
}
Wrapper for SIMD registers.
Definition wide.hpp:70