◆ bitwise_xor()

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

This function object returns the return the bitwise xor of the two parameters.

The result type is the one of the first operand.

Infix notation can be used with operator '^', but this will not work in scalar mode if any operand is floating point because of C++ limitations.

Header <boost/simd/function/bitwise_xor.hpp>
Precondition
The operands must share the same bit size.
Example:
#include <boost/simd/bitwise.hpp>
#include <boost/simd/constant/nan.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
int main() {
pack_it pi = {3, 2, 10, 1};
pack_it qi = {4, 1, 2, 5};
std::cout << "---- simd" << '\n'
<< " <- pi = " << pi << '\n'
<< " <- qi = " << qi << '\n'
<< " -> bs::bitwise_xor(pi, qi) = " << bs::bitwise_xor(pi, qi)
<< '\n';
std::uint32_t xi = 3, yi = 7;
std::cout << "---- scalar" << '\n'
<< " xi = " << xi << '\n'
<< " yi = " << yi << '\n'
<< " -> bs::bitwise_xor(xi, yi) = " << bs::bitwise_xor(xi, yi)
<< '\n';
return 0;
}
Possible output:
---- simd
<- pi = (3, 2, 10, 1)
<- qi = (4, 1, 2, 5)
-> bs::bitwise_xor(pi, qi) = (7, 3, 8, 4)
---- scalar
xi = 3
yi = 7
-> bs::bitwise_xor(xi, yi) = 4