Seems like it should convert to popcount(x) == 1 if it's available on the target arch, but looking at the code, doesn't seem like compiler would do it:
_NODISCARD constexpr bool has_single_bit(const _Ty _Val) noexcept {
return _Val != 0 && (_Val & (_Val - 1)) == 0;
}
|
return _Val != 0 && (_Val & (_Val - 1)) == 0;
|
Seems like it should convert to
popcount(x) == 1if it's available on the target arch, but looking at the code, doesn't seem like compiler would do it:STL/stl/inc/bit
Line 87 in f2a2933