mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Allow (Re)setting a range of values in a BaseBitSet.
parent
f0777737af
commit
9049710051
|
@ -52,6 +52,17 @@ public:
|
||||||
return static_cast<Timpl&>(*this);
|
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.
|
* Assign the value-th bit.
|
||||||
* @param value Bit to assign to.
|
* @param value Bit to assign to.
|
||||||
|
@ -74,6 +85,17 @@ public:
|
||||||
return static_cast<Timpl&>(*this);
|
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.
|
* Flip the value-th bit.
|
||||||
* @param value Bit to flip.
|
* @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.
|
* Test if the value-th bit is set.
|
||||||
* @param value Bit to check.
|
* @param value Bit to check.
|
||||||
|
|
Loading…
Reference in New Issue