(Bitset) Added Unbounded methods
Former-commit-id: 898eecf4aa8ecf7c9ec85fc8c46c17a6c3badc34
This commit is contained in:
parent
6b799b1887
commit
860712b09f
|
|
@ -70,6 +70,10 @@ class NzBitset
|
||||||
template<typename T> T To() const;
|
template<typename T> T To() const;
|
||||||
NzString ToString() const;
|
NzString ToString() const;
|
||||||
|
|
||||||
|
void UnboundedReset(unsigned int bit);
|
||||||
|
void UnboundedSet(unsigned int bit, bool val = true);
|
||||||
|
bool UnboundedTest(unsigned int bit) const;
|
||||||
|
|
||||||
Bit operator[](int index);
|
Bit operator[](int index);
|
||||||
bool operator[](int index) const;
|
bool operator[](int index) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -379,6 +379,34 @@ NzString NzBitset<Block, Allocator>::ToString() const
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Block, class Allocator>
|
||||||
|
void NzBitset<Block, Allocator>::UnboundedReset(unsigned int bit)
|
||||||
|
{
|
||||||
|
UnboundedSet(bit, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Block, class Allocator>
|
||||||
|
void NzBitset<Block, Allocator>::UnboundedSet(unsigned int bit, bool val)
|
||||||
|
{
|
||||||
|
if (bit < m_bitCount)
|
||||||
|
Set(bit, val);
|
||||||
|
else if (val)
|
||||||
|
{
|
||||||
|
// On élargit le bitset seulement s'il y a un bit à marquer
|
||||||
|
Resize(bit + 1, false);
|
||||||
|
Set(bit, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Block, class Allocator>
|
||||||
|
bool NzBitset<Block, Allocator>::UnboundedTest(unsigned int bit) const
|
||||||
|
{
|
||||||
|
if (bit < m_bitCount)
|
||||||
|
return Test(bit);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Block, class Allocator>
|
template<typename Block, class Allocator>
|
||||||
typename NzBitset<Block, Allocator>::Bit NzBitset<Block, Allocator>::operator[](int index)
|
typename NzBitset<Block, Allocator>::Bit NzBitset<Block, Allocator>::operator[](int index)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue