Skip to content

Commit e930644

Browse files
[ADT] clang-format PackedVector.h (NFC)
I'm planning to modify this file.
1 parent 9c6d216 commit e930644

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

llvm/include/llvm/ADT/PackedVector.h

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class PackedVectorBase<T, BitNum, BitVectorTy, true> {
4747
protected:
4848
static T getValue(const BitVectorTy &Bits, unsigned Idx) {
4949
T val = T();
50-
for (unsigned i = 0; i != BitNum-1; ++i)
50+
for (unsigned i = 0; i != BitNum - 1; ++i)
5151
val = T(val | ((Bits[(Idx * BitNum) + i] ? 1UL : 0UL) << i));
5252
if (Bits[(Idx * BitNum) + BitNum - 1])
5353
val = ~val;
@@ -61,8 +61,8 @@ class PackedVectorBase<T, BitNum, BitVectorTy, true> {
6161
} else {
6262
Bits.reset((Idx * BitNum) + BitNum - 1);
6363
}
64-
assert((val >> (BitNum-1)) == 0 && "value is too big");
65-
for (unsigned i = 0; i != BitNum-1; ++i)
64+
assert((val >> (BitNum - 1)) == 0 && "value is too big");
65+
for (unsigned i = 0; i != BitNum - 1; ++i)
6666
Bits[(Idx * BitNum) + i] = val & (T(1) << i);
6767
}
6868
};
@@ -75,8 +75,9 @@ class PackedVectorBase<T, BitNum, BitVectorTy, true> {
7575
/// will create a vector accepting values -2, -1, 0, 1. Any other value will hit
7676
/// an assertion.
7777
template <typename T, unsigned BitNum, typename BitVectorTy = BitVector>
78-
class PackedVector : public PackedVectorBase<T, BitNum, BitVectorTy,
79-
std::numeric_limits<T>::is_signed> {
78+
class PackedVector
79+
: public PackedVectorBase<T, BitNum, BitVectorTy,
80+
std::numeric_limits<T>::is_signed> {
8081
BitVectorTy Bits;
8182
// Keep track of the number of elements on our own.
8283
// We always maintain Bits.size() == NumElements * BitNum.
@@ -99,9 +100,7 @@ class PackedVector : public PackedVectorBase<T, BitNum, BitVectorTy,
99100
return *this;
100101
}
101102

102-
operator T() const {
103-
return Vec.getValue(Vec.Bits, Idx);
104-
}
103+
operator T() const { return Vec.getValue(Vec.Bits, Idx); }
105104
};
106105

107106
PackedVector() = default;
@@ -130,25 +129,17 @@ class PackedVector : public PackedVectorBase<T, BitNum, BitVectorTy,
130129
}
131130

132131
void push_back(T val) {
133-
resize(size()+1);
134-
(*this)[size()-1] = val;
132+
resize(size() + 1);
133+
(*this)[size() - 1] = val;
135134
}
136135

137-
reference operator[](unsigned Idx) {
138-
return reference(*this, Idx);
139-
}
136+
reference operator[](unsigned Idx) { return reference(*this, Idx); }
140137

141-
T operator[](unsigned Idx) const {
142-
return base::getValue(Bits, Idx);
143-
}
138+
T operator[](unsigned Idx) const { return base::getValue(Bits, Idx); }
144139

145-
bool operator==(const PackedVector &RHS) const {
146-
return Bits == RHS.Bits;
147-
}
140+
bool operator==(const PackedVector &RHS) const { return Bits == RHS.Bits; }
148141

149-
bool operator!=(const PackedVector &RHS) const {
150-
return Bits != RHS.Bits;
151-
}
142+
bool operator!=(const PackedVector &RHS) const { return Bits != RHS.Bits; }
152143

153144
PackedVector &operator|=(const PackedVector &RHS) {
154145
Bits |= RHS.Bits;

0 commit comments

Comments
 (0)