util: fix a ubsan complaint about undefined left-shift

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-07-26 12:06:10 +10:00
parent 708b3f0d8e
commit a738ba1aed

View file

@ -207,19 +207,19 @@ msleep(unsigned int ms)
static inline bool
long_bit_is_set(const unsigned long *array, int bit)
{
return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
return !!(array[bit / LONG_BITS] & (1ULL << (bit % LONG_BITS)));
}
static inline void
long_set_bit(unsigned long *array, int bit)
{
array[bit / LONG_BITS] |= (1LL << (bit % LONG_BITS));
array[bit / LONG_BITS] |= (1ULL << (bit % LONG_BITS));
}
static inline void
long_clear_bit(unsigned long *array, int bit)
{
array[bit / LONG_BITS] &= ~(1LL << (bit % LONG_BITS));
array[bit / LONG_BITS] &= ~(1ULL << (bit % LONG_BITS));
}
static inline void