Fix undefined behavior: left-shifting into the sign bit.
Reviewed by: dim, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22898
This commit is contained in:
parent
52f3524cfd
commit
107eff5176
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356039
@ -47,7 +47,7 @@
|
|||||||
#define _SIG_MAXSIG 128
|
#define _SIG_MAXSIG 128
|
||||||
#define _SIG_IDX(sig) ((sig) - 1)
|
#define _SIG_IDX(sig) ((sig) - 1)
|
||||||
#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
|
#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
|
||||||
#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
|
#define _SIG_BIT(sig) (1U << (_SIG_IDX(sig) & 31))
|
||||||
#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
|
#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
|
||||||
|
|
||||||
typedef struct __sigset {
|
typedef struct __sigset {
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#define __constexpr_cond(expr) (__builtin_constant_p((expr)) && (expr))
|
#define __constexpr_cond(expr) (__builtin_constant_p((expr)) && (expr))
|
||||||
|
|
||||||
#define __bitset_mask(_s, n) \
|
#define __bitset_mask(_s, n) \
|
||||||
(1L << (__constexpr_cond(__bitset_words((_s)) == 1) ? \
|
(1UL << (__constexpr_cond(__bitset_words((_s)) == 1) ? \
|
||||||
(__size_t)(n) : ((n) % _BITSET_BITS)))
|
(__size_t)(n) : ((n) % _BITSET_BITS)))
|
||||||
|
|
||||||
#define __bitset_word(_s, n) \
|
#define __bitset_word(_s, n) \
|
||||||
|
Loading…
Reference in New Issue
Block a user