E.V.E
v2022.09.01

◆ inc

eve::inc = {}
inlineconstexpr

return the input incremented by one.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T inc(T x) noexcept;
}
constexpr callable_inc_ inc
return the input incremented by one.
Definition: inc.hpp:71
Definition: all_of.hpp:22

Parameters

Return value

The value of x + 1 is returned.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> eve::inc(pf) = " << eve::inc(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::inc(xf) = " << eve::inc(xf) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::inc[mask](x, ...) provides a masked version of inc which is equivalent to if_else(mask, inc(x, ...), x)

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {0.0f, 1.0f, -1.0f, 10.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> eve::inc[pf < 5.0f](pf) = " << eve::inc[pf < 5.0f](pf) << '\n';
    return 0;
    }
  • eve::saturated

    The call saturated(inc)(x) computes the saturated increment of x. The only interest of this behaviour is that for integral type T the call saturated(inc)(Valmax<T>()) returns Valmax<T>().

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {0, 1, -127, -128};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> saturated(inc)(pf) = " << eve::saturated(eve::inc)(pf) << '\n';
    return 0;
    }
    constexpr saturated_type const saturated
    Higher-order Callable Object imbuing saturation semantic onto other Callable Objects.
    Definition: saturated.hpp:68