mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
add some inline methods for infix operators on sparse vectors,
tidy some df iteration stuff, patch by John Mosby! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67428 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -460,6 +460,11 @@ public:
|
||||
CurrElementIter = Elements.begin ();
|
||||
}
|
||||
|
||||
// Clear.
|
||||
void clear() {
|
||||
Elements.clear();
|
||||
}
|
||||
|
||||
// Assignment
|
||||
SparseBitVector& operator=(const SparseBitVector& RHS) {
|
||||
Elements.clear();
|
||||
@@ -836,7 +841,36 @@ inline bool operator &=(SparseBitVector<ElementSize> *LHS,
|
||||
template <unsigned ElementSize>
|
||||
inline bool operator &=(SparseBitVector<ElementSize> &LHS,
|
||||
const SparseBitVector<ElementSize> *RHS) {
|
||||
return LHS &= (*RHS);
|
||||
return LHS &= *RHS;
|
||||
}
|
||||
|
||||
// Convenience functions for infix union, intersection, difference operators.
|
||||
|
||||
template <unsigned ElementSize>
|
||||
inline SparseBitVector<ElementSize>
|
||||
operator|(const SparseBitVector<ElementSize> &LHS,
|
||||
const SparseBitVector<ElementSize> &RHS) {
|
||||
SparseBitVector<ElementSize> Result(LHS);
|
||||
Result |= RHS;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <unsigned ElementSize>
|
||||
inline SparseBitVector<ElementSize>
|
||||
operator&(const SparseBitVector<ElementSize> &LHS,
|
||||
const SparseBitVector<ElementSize> &RHS) {
|
||||
SparseBitVector<ElementSize> Result(LHS);
|
||||
Result &= RHS;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <unsigned ElementSize>
|
||||
inline SparseBitVector<ElementSize>
|
||||
operator-(const SparseBitVector<ElementSize> &LHS,
|
||||
const SparseBitVector<ElementSize> &RHS) {
|
||||
SparseBitVector<ElementSize> Result;
|
||||
Result.intersectWithComplement(LHS, RHS);
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
@@ -849,10 +883,8 @@ void dump(const SparseBitVector<ElementSize> &LHS, llvm::OStream &out) {
|
||||
for (bi = LHS.begin(); bi != LHS.end(); ++bi) {
|
||||
out << *bi << " ";
|
||||
}
|
||||
out << " ]\n";
|
||||
out << " ]\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user