diff options
Diffstat (limited to 'include/cru/common/Bitmask.h')
-rw-r--r-- | include/cru/common/Bitmask.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/cru/common/Bitmask.h b/include/cru/common/Bitmask.h index 23a3a069..9b6b8957 100644 --- a/include/cru/common/Bitmask.h +++ b/include/cru/common/Bitmask.h @@ -1,4 +1,5 @@ #pragma once + #include <functional> namespace cru { @@ -13,6 +14,8 @@ struct Bitmask final { return Bitmask(static_cast<TUnderlying>(1u << offset)); } + constexpr bool Has(Bitmask rhs) const { return (value & rhs.value) != 0; } + Bitmask operator|(Bitmask rhs) const { return Bitmask(value | rhs.value); } Bitmask operator&(Bitmask rhs) const { return Bitmask(value & rhs.value); } Bitmask operator^(Bitmask rhs) const { return Bitmask(value ^ rhs.value); } @@ -34,7 +37,7 @@ struct Bitmask final { bool operator!=(Bitmask rhs) const { return this->value != rhs.value; } explicit operator TUnderlying() const { return value; } - explicit operator bool() const { return value != 0; } + operator bool() const { return value != 0; } TUnderlying value; }; |