mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-03-06 14:27:44 +00:00
Added SetOnes() and SetZeros()
This commit is contained in:
parent
c3eef706e8
commit
3041ca1922
|
@ -210,12 +210,26 @@ namespace Util
|
|||
Insert(0, value);
|
||||
}
|
||||
|
||||
void BitRegister::SetZeros()
|
||||
{
|
||||
if (Empty())
|
||||
return;
|
||||
memset(m_bits.data(), 0, m_bits.size());
|
||||
}
|
||||
|
||||
void BitRegister::SetZeros(size_t count)
|
||||
{
|
||||
m_bits.resize(count);
|
||||
memset(m_bits.data(), 0, count);
|
||||
}
|
||||
|
||||
void BitRegister::SetOnes()
|
||||
{
|
||||
if (Empty())
|
||||
return;
|
||||
memset(m_bits.data(), 1, m_bits.size());
|
||||
}
|
||||
|
||||
void BitRegister::SetOnes(size_t count)
|
||||
{
|
||||
m_bits.resize(count);
|
||||
|
|
|
@ -41,6 +41,10 @@ namespace Util
|
|||
// Functions that insert bits, clipped against current register size
|
||||
void SetBit(size_t bitPos, uint8_t value);
|
||||
void Insert(size_t bitPos, const std::string &value);
|
||||
|
||||
// Functions that reset the contents but not the size of the register
|
||||
void SetZeros();
|
||||
void SetOnes();
|
||||
|
||||
// Functions that reset the contents (and size) of the register
|
||||
void Set(const std::string &value);
|
||||
|
|
Loading…
Reference in a new issue