BUG: bitSet &= operation does not mask out non-overlapping (#2456)
- the values from non-overlapping blocks were simply ignored, which meant that ('111111111111' & '111111') would not mask out the unset values at all. - similar oddities in other operations (|=, ^= etc) where the original implementation tried hard to avoid touching the sizing at all, but now better resolved as follows: - '|=' : Set may grow to accommodate new 'on' bits. - '^=' : Set may grow to accommodate new 'on' bits. - '-=' : Never changes the original set size. - '&=' : Never changes the original set size. Non-overlapping elements are considered 'off'. These definitions are consistent with HashSet behaviour and also ensures that (a & b) == (b & a) ENH: improve short-circuiting within bitSet ops - in a few places can optimise by checking for none() instead of empty() and avoid unnecessary block operations. ENH: added bitSet::resize_last() method - as the name says: resizes to the last bit set. A friendlier way of writing `resize(find_last()+1)`
Showing
- applications/test/bitSet2/Test-bitSet2.C 23 additions, 0 deletionsapplications/test/bitSet2/Test-bitSet2.C
- src/OpenFOAM/containers/Bits/PackedList/PackedList.H 1 addition, 1 deletionsrc/OpenFOAM/containers/Bits/PackedList/PackedList.H
- src/OpenFOAM/containers/Bits/bitSet/bitSet.C 36 additions, 104 deletionssrc/OpenFOAM/containers/Bits/bitSet/bitSet.C
- src/OpenFOAM/containers/Bits/bitSet/bitSet.H 26 additions, 19 deletionssrc/OpenFOAM/containers/Bits/bitSet/bitSet.H
- src/OpenFOAM/containers/Bits/bitSet/bitSetI.H 34 additions, 6 deletionssrc/OpenFOAM/containers/Bits/bitSet/bitSetI.H
Please register or sign in to comment