◆ genmaskc()

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

This function object returns a mask of bits.

This mask is full of ones if the input element is Zero else full of zeros.

Header <boost/simd/function/genmaskc.hpp>
See also
genmask
Example:
#include <boost/simd/bitwise.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, -0.0f, 0.0f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::genmaskc(pf) = " << bs::genmaskc(pf) << '\n';
float xf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "-> bs::genmaskc(xf) = " << bs::genmaskc(xf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, -0, 0, 0.5)
-> bs::genmaskc(pf) = (0, -nan, -nan, 0)
---- scalar
<- xf = 2
-> bs::genmaskc(xf) = 0
Alias:
if_zero_else_allbits
See also
if_else_allbits