constexpr functions are not allowed to have static variables, and if they are constexpr anyways then them being static has no benifit (#677)
parent
b9ff9fa6d9
commit
a752d920d1
|
@ -99,10 +99,10 @@ constexpr std::enable_if_t<std::is_integral<T>::value && std::is_unsigned<T>::va
|
|||
int> popcount(T val) noexcept
|
||||
{
|
||||
using fast_type = typename detail_::fast_utype<T>::type;
|
||||
static constexpr fast_type b01010101{detail_::repbits<fast_type>(0x55)};
|
||||
static constexpr fast_type b00110011{detail_::repbits<fast_type>(0x33)};
|
||||
static constexpr fast_type b00001111{detail_::repbits<fast_type>(0x0f)};
|
||||
static constexpr fast_type b00000001{detail_::repbits<fast_type>(0x01)};
|
||||
constexpr fast_type b01010101{detail_::repbits<fast_type>(0x55)};
|
||||
constexpr fast_type b00110011{detail_::repbits<fast_type>(0x33)};
|
||||
constexpr fast_type b00001111{detail_::repbits<fast_type>(0x0f)};
|
||||
constexpr fast_type b00000001{detail_::repbits<fast_type>(0x01)};
|
||||
|
||||
fast_type v{fast_type{val} - ((fast_type{val} >> 1) & b01010101)};
|
||||
v = (v & b00110011) + ((v >> 2) & b00110011);
|
||||
|
|
Loading…
Reference in New Issue