fix(containers): fix operator&= operator|= and operator^= of TBitset

This commit is contained in:
_Redstone_c_ 2023-03-17 19:09:48 +08:00
parent 1b33d3b166
commit 5b7a90cd0b
1 changed files with 10 additions and 14 deletions

View File

@ -285,7 +285,9 @@ public:
{
if (&InValue == this) UNLIKELY return *this;
if (Num() == 0 || InValue.Num() == 0) return *this;
if (Num() == 0) return *this;
if (InValue.Num() == 0) return Set(false);
if (Num() <= InValue.Num())
{
@ -309,7 +311,7 @@ public:
for (size_t Index = LastBlock + 1; Index != NumBlocks(); ++Index)
{
Impl.Pointer[Index] &= 0;
Impl.Pointer[Index] = 0;
}
}
@ -321,7 +323,9 @@ public:
{
if (&InValue == this) UNLIKELY return *this;
if (Num() == 0 || InValue.Num() == 0) return *this;
if (Num() == 0) return *this;
if (InValue.Num() == 0) return *this;
if (Num() <= InValue.Num())
{
@ -342,11 +346,6 @@ public:
const BlockType LastBlockBitmask = InValue.Num() % BlockWidth != 0 ? (1ull << InValue.Num() % BlockWidth) - 1 : -1;
Impl.Pointer[LastBlock] |= InValue.Impl.Pointer[LastBlock] & LastBlockBitmask;
for (size_t Index = LastBlock + 1; Index != NumBlocks(); ++Index)
{
Impl.Pointer[Index] |= 0;
}
}
return *this;
@ -357,7 +356,9 @@ public:
{
if (&InValue == this) UNLIKELY return *this;
if (Num() == 0 || InValue.Num() == 0) return *this;
if (Num() == 0) return *this;
if (InValue.Num() == 0) return *this;
if (Num() <= InValue.Num())
{
@ -378,11 +379,6 @@ public:
const BlockType LastBlockBitmask = InValue.Num() % BlockWidth != 0 ? (1ull << InValue.Num() % BlockWidth) - 1 : -1;
Impl.Pointer[LastBlock] ^= InValue.Impl.Pointer[LastBlock] & LastBlockBitmask;
for (size_t Index = LastBlock + 1; Index != NumBlocks(); ++Index)
{
Impl.Pointer[Index] ^= 0;
}
}
return *this;