E.V.E
v2023.02.15

◆ dec

eve::dec = {}
inlineconstexpr

return the input decremented by 1.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T >
T dec(T x) noexcept;
}
constexpr callable_dec_ dec
return the input decremented by 1.
Definition: dec.hpp:71
Definition: abi.hpp:18

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'
<< "-> dec(pf) = " << eve::dec(pf) << '\n';
float xf = 1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> eve::dec(xf) = " << eve::dec(xf) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::dec[mask](x, ...) provides a masked version of dec which is equivalent to if_else(mask, dec(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, -2.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "-> dec[pf > 0.0f](pf) = " << eve::dec[pf > 0.0f](pf) << '\n';
    return 0;
    }
  • eve::saturated

    The call saturated(dec)(x) computes the saturated decrement of x. The only interest of this behaviour is that for integral type T the call saturated(dec)(Valmin<T>()) returns Valmin<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(dec)(pf) = " << eve::saturated(eve::dec)(pf) << '\n';
    return 0;
    }
    constexpr saturated_type const saturated
    Higher-order Callable Object imbuing saturation semantic onto other Callable Objects.
    Definition: saturated.hpp:68