diff options
Diffstat (limited to 'deps/v8/src/base/flags.h')
-rw-r--r-- | deps/v8/src/base/flags.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/deps/v8/src/base/flags.h b/deps/v8/src/base/flags.h index 467ecf67c9..6bdb69319d 100644 --- a/deps/v8/src/base/flags.h +++ b/deps/v8/src/base/flags.h @@ -5,6 +5,8 @@ #ifndef V8_BASE_FLAGS_H_ #define V8_BASE_FLAGS_H_ +#include <cstddef> + #include "src/base/compiler-specific.h" namespace v8 { @@ -30,6 +32,13 @@ class Flags final { : mask_(static_cast<S>(flag)) {} explicit Flags(mask_type mask) : mask_(static_cast<S>(mask)) {} + bool operator==(flag_type flag) const { + return mask_ == static_cast<S>(flag); + } + bool operator!=(flag_type flag) const { + return mask_ != static_cast<S>(flag); + } + Flags& operator&=(const Flags& flags) { mask_ &= flags.mask_; return *this; @@ -60,6 +69,8 @@ class Flags final { operator mask_type() const { return mask_; } bool operator!() const { return !mask_; } + friend size_t hash_value(const Flags& flags) { return flags.mask_; } + private: mask_type mask_; }; @@ -97,13 +108,17 @@ class Flags final { ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) { \ return Type(lhs) ^ rhs; \ - } inline Type operator^(Type::flag_type lhs, const Type& rhs) \ + } inline Type \ + operator^(Type::flag_type lhs, const Type& rhs) \ ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ inline Type operator^(Type::flag_type lhs, const Type& rhs) { \ return rhs ^ lhs; \ - } inline void operator^(Type::flag_type lhs, Type::mask_type rhs) \ - ALLOW_UNUSED_TYPE; \ - inline void operator^(Type::flag_type lhs, Type::mask_type rhs) {} + } inline void \ + operator^(Type::flag_type lhs, Type::mask_type rhs) ALLOW_UNUSED_TYPE; \ + inline void operator^(Type::flag_type lhs, Type::mask_type rhs) { \ + } inline Type \ + operator~(Type::flag_type val)ALLOW_UNUSED_TYPE; \ + inline Type operator~(Type::flag_type val) { return ~Type(val); } } // namespace base } // namespace v8 |