mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-22 11:44:17 +01:00
Codechange: Add Reset() and missing &=/|= operators for BaseBitSet.
This commit is contained in:
committed by
Peter Nelson
parent
c4d033967b
commit
e0dbbbb032
@@ -76,6 +76,16 @@ public:
|
||||
return set ? this->Set(value) : this->Reset(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all bits.
|
||||
* @returns The bit set
|
||||
*/
|
||||
inline constexpr Timpl &Reset()
|
||||
{
|
||||
this->data = 0;
|
||||
return static_cast<Timpl &>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the value-th bit.
|
||||
* @param value Bit to reset.
|
||||
@@ -180,12 +190,24 @@ public:
|
||||
return this->data == 0;
|
||||
}
|
||||
|
||||
inline constexpr Timpl operator |(const Timpl &other) const
|
||||
inline constexpr Timpl &operator|=(const Timpl &other)
|
||||
{
|
||||
this->data |= other.data;
|
||||
return static_cast<Timpl &>(*this);
|
||||
}
|
||||
|
||||
inline constexpr Timpl operator|(const Timpl &other) const
|
||||
{
|
||||
return Timpl{static_cast<Tstorage>(this->data | other.data)};
|
||||
}
|
||||
|
||||
inline constexpr Timpl operator &(const Timpl &other) const
|
||||
inline constexpr Timpl &operator&=(const Timpl &other)
|
||||
{
|
||||
this->data &= other.data;
|
||||
return static_cast<Timpl &>(*this);
|
||||
}
|
||||
|
||||
inline constexpr Timpl operator&(const Timpl &other) const
|
||||
{
|
||||
return Timpl{static_cast<Tstorage>(this->data & other.data)};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user