mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add Reset() and missing &=/|= operators for BaseBitSet.
parent
c4d033967b
commit
e0dbbbb032
|
@ -76,6 +76,16 @@ public:
|
||||||
return set ? this->Set(value) : this->Reset(value);
|
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.
|
* Reset the value-th bit.
|
||||||
* @param value Bit to reset.
|
* @param value Bit to reset.
|
||||||
|
@ -180,12 +190,24 @@ public:
|
||||||
return this->data == 0;
|
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)};
|
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)};
|
return Timpl{static_cast<Tstorage>(this->data & other.data)};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue