diff options
-rw-r--r-- | src/common/bits.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/bits.c b/src/common/bits.c index cdcef85..32041b9 100644 --- a/src/common/bits.c +++ b/src/common/bits.c @@ -582,7 +582,7 @@ size_t popcount_for_bit_field(const bitfield_t *field) value = field->bits[i]; if (remaining < (8 * sizeof(unsigned long))) - value &= 1 << (remaining - 1); + value &= (1lu << (remaining + 1)) - 1; #if __WORDSIZE == 64 result += popcount_64(value); |