1
0
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:
Peter Nelson
2025-05-06 20:07:45 +01:00
committed by Peter Nelson
parent c4d033967b
commit e0dbbbb032

View File

@@ -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)};
}