## ◆ oneminus()

 Value boost::simd::oneminus ( Value const & x )

This function object returns one minus the entry.

Notes
Using oneminus(x) is similar to 1-x
Decorator

saturated is available, but for unsigned integral types the saturated_ function is merely equivalent to x == 0 ? 1 : 0

Example:
#include <boost/simd/arithmetic.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack <float, 4>;
int main()
{
pack_ft pf = {-1.0f, 2.0f, -3.0f, -32768.0f};
pack_it pi = { 0, -1, 2, 3 };
std::cout
<< "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::oneminus(pf) = " << bs::oneminus(pf) << '\n'
<< "<- pi = " << pi << '\n'
<< "-> bs::oneminus(pi) = " << bs::oneminus(pi) << '\n'
<< "-> bs::saturated_(bs::oneminus(pi)) = " << bs::saturated_(bs::oneminus)(pi) << '\n';
float xf = -327.0f;
std::uint16_t xi = 2;
std::cout
<< "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::oneminus(xf) = " << bs::oneminus(xf) << '\n'
<< "<- xi = " << xi << '\n'
<< "-> bs::oneminus(xi) = " << bs::oneminus(xi) << '\n'
<< "-> bs::saturated_(bs::oneminus(xi)) = " << bs::saturated_(bs::oneminus)(xi) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (-1, 2, -3, -32768)
-> bs::oneminus(pf) = (2, -1, 4, 32769)
<- pi = (0, 65535, 2, 3)
-> bs::oneminus(pi) = (1, 2, 65535, 65534)
-> bs::saturated_(bs::oneminus(pi)) = (1, 0, 0, 0)
---- scalar
<- xf = -327
-> bs::oneminus(xf) = 328
<- xi = 2
-> bs::oneminus(xi) = 65535