◆ ifnot_plus()

Value1 boost::simd::ifnot_plus ( Value0 const &  c,
Value1 const &  x,
Value1 const &  y 
)

This function object conditionally returns x (respectively x+y) if c is True (respectively False)

Header <boost/simd/function/ifnot_plus.hpp>
Example:
#include <boost/simd/boolean.hpp>
#include <boost/simd/pack.hpp>
#include <boost/simd/constant/valmax.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack <float, 4>;
int main()
{
pack_ft sf = { 3.0f, -0.0f, -3.0f, 0.0 };
pack_ft pf = { 3.0f, -2.0f, -6.0f, bs::Valmax<float>() };
pack_ft qf = { 4.0f, -1.0f, -3.0f, 0.0f };
std::cout
<< "---- simd" << '\n'
<< " <- pf = " << pf << '\n'
<< " <- qf = " << qf << '\n'
<< " -> bs::ifnot_plus(sf, pf, qf) = " << bs::ifnot_plus(sf, pf, qf) << '\n';
float xf = 3.0f, yf = -4.0f;
std::cout
<< "---- scalar" << '\n'
<< " xf = " << xf << '\n'
<< " yf = " << yf << '\n'
<< " -> bs::ifnot_plus(xf > 0.0f, xf, yf) = " << bs::ifnot_plus(xf > 0.0f, xf, yf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (3, -2, -6, 3.40282e+38)
<- qf = (4, -1, -3, 0)
-> bs::ifnot_plus(sf, pf, qf) = (3, -3, -6, 3.40282e+38)
---- scalar
xf = 3
yf = -4
-> bs::ifnot_plus(xf > 0.0f, xf, yf) = 3