mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-23 14:39:08 +00:00
Codechange: Allow (Re)setting a range of values in a BaseBitSet.
This commit is contained in:
@@ -52,6 +52,17 @@ public:
|
||||
return static_cast<Timpl&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set values from another bitset.
|
||||
* @param other Bitset of values to set.
|
||||
* @returns The bit set
|
||||
*/
|
||||
inline constexpr Timpl &Set(const Timpl &other)
|
||||
{
|
||||
this->data |= other.data;
|
||||
return static_cast<Timpl&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign the value-th bit.
|
||||
* @param value Bit to assign to.
|
||||
@@ -74,6 +85,17 @@ public:
|
||||
return static_cast<Timpl&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset values from another bitset.
|
||||
* @param other Bitset of values to reset.
|
||||
* @returns The bit set
|
||||
*/
|
||||
inline constexpr Timpl &Reset(const Timpl &other)
|
||||
{
|
||||
this->data &= ~other.data;
|
||||
return static_cast<Timpl&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the value-th bit.
|
||||
* @param value Bit to flip.
|
||||
@@ -88,6 +110,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip values from another bitset.
|
||||
* @param other Bitset of values to flip.
|
||||
* @returns The bit set
|
||||
*/
|
||||
inline constexpr Timpl &Flip(const Timpl &other)
|
||||
{
|
||||
this->data ^= other.data;
|
||||
return static_cast<Timpl&>(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the value-th bit is set.
|
||||
* @param value Bit to check.
|
||||
|
Reference in New Issue
Block a user