Add macro for checking if some flags are set
This way we don't need to repeat the argument twice. I didn't replace all instances. I think it's better to leave out: - asserts - comparisons like x & y == x, which are mathematically equivalent, but here we aren't checking if flags are set, but if the argument fits in the flags.
This commit is contained in:
@@ -357,6 +357,8 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
|
||||
|
||||
#define SET_FLAG(v, flag, b) \
|
||||
(v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
|
||||
#define FLAGS_SET(v, flags) \
|
||||
(((v) & (flags)) == (flags))
|
||||
|
||||
#define CASE_F(X) case X:
|
||||
#define CASE_F_1(CASE, X) CASE_F(X)
|
||||
|
||||
Reference in New Issue
Block a user