mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
dynamic_bitset requires both sets to be same size
This commit is contained in:
parent
f34f962455
commit
7ea6206126
@ -185,22 +185,76 @@ public:
|
|||||||
|
|
||||||
// Compound assignment AND operator
|
// Compound assignment AND operator
|
||||||
BASE_SET& operator&=(const BASE_SET& other)
|
BASE_SET& operator&=(const BASE_SET& other)
|
||||||
|
{
|
||||||
|
size_t my_size = size();
|
||||||
|
size_t other_size = other.size();
|
||||||
|
|
||||||
|
if( my_size == other_size )
|
||||||
{
|
{
|
||||||
sul::dynamic_bitset<uint64_t>::operator&=(other);
|
sul::dynamic_bitset<uint64_t>::operator&=(other);
|
||||||
|
}
|
||||||
|
else if( my_size < other_size )
|
||||||
|
{
|
||||||
|
sul::dynamic_bitset<uint64_t>::resize( other_size );
|
||||||
|
sul::dynamic_bitset<uint64_t>::operator&=( other );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BASE_SET tmp( other );
|
||||||
|
tmp.resize( my_size );
|
||||||
|
sul::dynamic_bitset<uint64_t>::operator&=( tmp );
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compound assignment OR operator
|
// Compound assignment OR operator
|
||||||
BASE_SET& operator|=(const BASE_SET& other)
|
BASE_SET& operator|=(const BASE_SET& other)
|
||||||
|
{
|
||||||
|
size_t my_size = size();
|
||||||
|
size_t other_size = other.size();
|
||||||
|
|
||||||
|
if( my_size == other_size )
|
||||||
{
|
{
|
||||||
sul::dynamic_bitset<uint64_t>::operator|=(other);
|
sul::dynamic_bitset<uint64_t>::operator|=(other);
|
||||||
|
}
|
||||||
|
else if( my_size < other_size )
|
||||||
|
{
|
||||||
|
sul::dynamic_bitset<uint64_t>::resize( other_size );
|
||||||
|
sul::dynamic_bitset<uint64_t>::operator|=( other );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BASE_SET tmp( other );
|
||||||
|
tmp.resize( my_size );
|
||||||
|
sul::dynamic_bitset<uint64_t>::operator|=( tmp );
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compound assignment XOR operator
|
// Compound assignment XOR operator
|
||||||
BASE_SET& operator^=(const BASE_SET& other)
|
BASE_SET& operator^=(const BASE_SET& other)
|
||||||
|
{
|
||||||
|
size_t my_size = size();
|
||||||
|
size_t other_size = other.size();
|
||||||
|
|
||||||
|
if( my_size == other_size )
|
||||||
{
|
{
|
||||||
sul::dynamic_bitset<uint64_t>::operator^=(other);
|
sul::dynamic_bitset<uint64_t>::operator^=(other);
|
||||||
|
}
|
||||||
|
else if( my_size < other_size )
|
||||||
|
{
|
||||||
|
sul::dynamic_bitset<uint64_t>::resize( other_size );
|
||||||
|
sul::dynamic_bitset<uint64_t>::operator^=( other );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BASE_SET tmp( other );
|
||||||
|
tmp.resize( my_size );
|
||||||
|
sul::dynamic_bitset<uint64_t>::operator^=( tmp );
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user