◆ logical_or()

as_logical_t<Value0> boost::simd::logical_or ( Value0 const &  x,
Value1 const &  y 
)

This function object returns the return the logical or of the two arguments.

Infix notation can be used with operator '||'

Header <boost/simd/function/logical_or.hpp>
Note
  • The result type is the logical type associated to the first argument.
Precondition
The operands must share the same cardinal_of value.
Warning
Take care that using || in scalar mode does short-circuit and does not in simd mode.
See also
logical_not, logical_xor, logical_andnot, logical_notand, logical_ornot, logical_and, logical_notor
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 pf = { 3.0f, -0.0f, -3.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::logical_or(pf, qf) = " << bs::logical_or(pf, qf) << '\n';
float xf = 3.0f, yf = 4.0f;
std::cout
<< "---- scalar" << '\n'
<< " xf = " << xf << '\n'
<< " yf = " << yf << '\n'
<< " -> bs::logical_or(xf, yf) = " << bs::logical_or(xf, yf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (3, -0, -3, 3.40282e+38)
<- qf = (4, -1, -3, 0)
-> bs::logical_or(pf, qf) = (true, true, true, true)
---- scalar
xf = 3
yf = 4
-> bs::logical_or(xf, yf) = true