#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator_range.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
};
class BitVector {
- using BitWord = unsigned long;
+ typedef unsigned long BitWord;
enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * CHAR_BIT };
"Unsupported word size");
MutableArrayRef<BitWord> Bits; // Actual bits.
- unsigned Size = 0; // Size of bitvector in bits.
+ unsigned Size; // Size of bitvector in bits.
public:
- using size_type = unsigned;
-
+ typedef unsigned size_type;
// Encapsulation of a single bit.
class reference {
friend class BitVector;
}
};
+ typedef const_set_bits_iterator_impl<BitVector> const_set_bits_iterator;
+ typedef const_set_bits_iterator set_iterator;
+
+ const_set_bits_iterator set_bits_begin() const {
+ return const_set_bits_iterator(*this);
+ }
+ const_set_bits_iterator set_bits_end() const {
+ return const_set_bits_iterator(*this, -1);
+ }
+ iterator_range<const_set_bits_iterator> set_bits() const {
+ return make_range(set_bits_begin(), set_bits_end());
+ }
+
/// BitVector default ctor - Creates an empty bitvector.
- BitVector() = default;
+ BitVector() : Size(0) {}
/// BitVector ctor - Creates a bitvector of specified number of bits. All
/// bits are initialized to the specified value.
~BitVector() { std::free(Bits.data()); }
- using const_set_bits_iterator = const_set_bits_iterator_impl<BitVector>;
- using set_iterator = const_set_bits_iterator;
-
- const_set_bits_iterator set_bits_begin() const {
- return const_set_bits_iterator(*this);
- }
-
- const_set_bits_iterator set_bits_end() const {
- return const_set_bits_iterator(*this, -1);
- }
-
- iterator_range<const_set_bits_iterator> set_bits() const {
- return make_range(set_bits_begin(), set_bits_end());
- }
-
/// empty - Tests whether there are no bits in this bitvector.
bool empty() const { return Size == 0; }
} // end namespace llvm
namespace std {
-
-/// Implement std::swap in terms of BitVector swap.
-inline void
-swap(llvm::BitVector &LHS, llvm::BitVector &RHS) {
- LHS.swap(RHS);
-}
-
+ /// Implement std::swap in terms of BitVector swap.
+ inline void
+ swap(llvm::BitVector &LHS, llvm::BitVector &RHS) {
+ LHS.swap(RHS);
+ }
} // end namespace std
#endif // LLVM_ADT_BITVECTOR_H