diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h --- a/sys/sys/bitset.h +++ b/sys/sys/bitset.h @@ -193,11 +193,13 @@ #define BIT_TEST_CLR_ATOMIC(_s, n, p) \ (atomic_testandclear_long( \ - &(p)->__bits[__bitset_word((_s), (n))], (n)) != 0) + &(p)->__bits[__bitset_word((_s), (n))], \ + (n) % _BITSET_BITS) != 0) #define BIT_TEST_SET_ATOMIC(_s, n, p) \ (atomic_testandset_long( \ - &(p)->__bits[__bitset_word((_s), (n))], (n)) != 0) + &(p)->__bits[__bitset_word((_s), (n))], \ + (n) % _BITSET_BITS) != 0) /* Convenience functions catering special cases. */ #define BIT_AND_ATOMIC(_s, d, s) do { \