◆ firstbitunset()

as_integer_t<Value> boost::simd::firstbitunset ( Value const &  x)

This function object returns the bit pattern in which the only bit set is the first bit unset (beginning with the least significant bit) in the parameter.

See also
ffs, firstbitset
Header <boost/simd/function/firstbitunset.hpp>
Example:
#include <boost/simd/bitwise.hpp>
#include <boost/simd/pack.hpp>
#include <iostream>
namespace bs = boost::simd;
int main() {
pack_it pi = {1, 2, 10, 1023};
std::cout << "---- simd" << '\n'
<< "<- pi = " << pi << '\n'
<< "-> bs::firstbitunset(pi) = " << bs::firstbitunset(pi) << '\n';
std::uint32_t xi = 2;
std::cout << "---- scalar" << '\n'
<< "<- xi = " << xi << '\n'
<< "-> bs::firstbitunset(xi) = " << bs::firstbitunset(xi) << '\n';
return 0;
}
Possible output:
---- simd
<- pi = (1, 2, 10, 1023)
-> bs::firstbitunset(pi) = (2, 1, 1, 1024)
---- scalar
<- xi = 2