summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorTimothy <timmot@users.noreply.github.com>2021-07-14 21:59:22 +1000
committerAndreas Kling <kling@serenityos.org>2021-07-16 11:49:50 +0200
commit971531183746d4481f6f475ef80bea90c6f03df5 (patch)
tree63dd673608b7e8a603f8f23b2b15b99373085404 /AK
parent371911b1b52f6abb126342304391b89d9c9accc7 (diff)
downloadserenity-971531183746d4481f6f475ef80bea90c6f03df5.zip
AK+Kernel: Implement and use EnumBits has_any_flag()
This duplicates the old functionality of has_flag and will return true when any flags present in the mask are also in the value.
Diffstat (limited to 'AK')
-rw-r--r--AK/EnumBits.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/AK/EnumBits.h b/AK/EnumBits.h
index a1216b8c26..9ee954056a 100644
--- a/AK/EnumBits.h
+++ b/AK/EnumBits.h
@@ -78,4 +78,10 @@
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Type>(value & mask) == static_cast<Type>(mask); \
+ } \
+ \
+ Prefix constexpr bool has_any_flag(Enum value, Enum mask) \
+ { \
+ using Type = UnderlyingType<Enum>; \
+ return static_cast<Type>(value & mask) != 0; \
}