diff options
author | crupest <crupest@outlook.com> | 2024-06-24 00:06:25 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2024-08-18 16:50:20 +0800 |
commit | 1b30150ab79ff1338f209a8ddb54b3dc60cfb599 (patch) | |
tree | 97e183587b293ecf768476da0edf3fdcf86e4543 /include/cru/common/Bitmask.h | |
parent | b756bf519cda0684ec46d0d9404cbc59741ec0cb (diff) | |
download | cru-1b30150ab79ff1338f209a8ddb54b3dc60cfb599.tar.gz cru-1b30150ab79ff1338f209a8ddb54b3dc60cfb599.tar.bz2 cru-1b30150ab79ff1338f209a8ddb54b3dc60cfb599.zip |
fix(SubProcess): fix pipe fs close, add tests.
NEED TEST: BufferStream, AutoReadStream, SubProcess.
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; }; |