BitSet: truncation in or_and
For "this |= set1 & set2" the result size should be "max(this, min(set1, set2))" while at present it is "min(set1, set2)" resulting in truncation if the LHS is longer than the RHS.
This commit is contained in:
@@ -279,7 +279,8 @@ namespace epics { namespace pvData {
|
||||
uint32 inUse = (set1.wordsInUse < set2.wordsInUse) ? set1.wordsInUse : set2.wordsInUse;
|
||||
|
||||
ensureCapacity(inUse);
|
||||
wordsInUse = inUse;
|
||||
if(inUse>wordsInUse)
|
||||
wordsInUse = inUse;
|
||||
|
||||
// Perform logical AND on words in common
|
||||
for (uint32 i = 0; i < inUse; i++)
|
||||
|
||||
@@ -152,9 +152,7 @@ static void testOperators()
|
||||
b3.clear(); b3.set(1);
|
||||
std::cout<<"# "<<toString(b3)<<" |= "<<toString(b1)<<" & "<<toString(b2)<<"\n";
|
||||
b3.or_and(b1, b2);
|
||||
testTodoBegin("Bug in or_and");
|
||||
testOk(toString(b3) == "{1}", "%s == {1}", toString(b3).c_str());
|
||||
testTodoEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user