Commit 151b85a0 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[base] Pass EnumSet by value

EnumSet hold a single integral field, hence it should be passed by
value. All users already do this, we are just inconsistent within the
declaration of EnumSet itself.

R=mlippautz@chromium.org

Change-Id: Ic2cac35fbd8fe3e98c1fe135bd334547dca30ab5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071872Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66447}
parent eb201d6f
......@@ -29,24 +29,18 @@ class EnumSet {
bool empty() const { return bits_ == 0; }
bool contains(E element) const { return (bits_ & Mask(element)) != 0; }
bool contains_any(const EnumSet& set) const {
return (bits_ & set.bits_) != 0;
}
bool contains_any(EnumSet set) const { return (bits_ & set.bits_) != 0; }
void Add(E element) { bits_ |= Mask(element); }
void Add(const EnumSet& set) { bits_ |= set.bits_; }
void Add(EnumSet set) { bits_ |= set.bits_; }
void Remove(E element) { bits_ &= ~Mask(element); }
void Remove(const EnumSet& set) { bits_ &= ~set.bits_; }
void Remove(EnumSet set) { bits_ &= ~set.bits_; }
void RemoveAll() { bits_ = 0; }
void Intersect(const EnumSet& set) { bits_ &= set.bits_; }
void Intersect(EnumSet set) { bits_ &= set.bits_; }
T ToIntegral() const { return bits_; }
bool operator==(const EnumSet& set) const { return bits_ == set.bits_; }
bool operator!=(const EnumSet& set) const { return bits_ != set.bits_; }
EnumSet operator|(const EnumSet& set) const {
return EnumSet(bits_ | set.bits_);
}
EnumSet operator&(const EnumSet& set) const {
return EnumSet(bits_ & set.bits_);
}
bool operator==(EnumSet set) const { return bits_ == set.bits_; }
bool operator!=(EnumSet set) const { return bits_ != set.bits_; }
EnumSet operator|(EnumSet set) const { return EnumSet(bits_ | set.bits_); }
EnumSet operator&(EnumSet set) const { return EnumSet(bits_ & set.bits_); }
static constexpr EnumSet FromIntegral(T bits) { return EnumSet{bits}; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment