Add yet another tiny helper to manipulate flags

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-04-10 16:40:48 +02:00
parent 7d6342e401
commit 0da965037e
4 changed files with 7 additions and 20 deletions
+3 -1
View File
@@ -451,8 +451,10 @@ static inline int __coverity_check_and_return__(int condition) {
ans; \
})
#define UPDATE_FLAG(orig, flag, b) \
((b) ? ((orig) | (flag)) : ((orig) & ~(flag)))
#define SET_FLAG(v, flag, b) \
(v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
(v) = UPDATE_FLAG(v, flag, b)
#define FLAGS_SET(v, flags) \
((~(v) & (flags)) == 0)