Skip to content

Commit d16663b

Browse files
committed
fix style
1 parent c0fc8f1 commit d16663b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/include/llvm/ADT/EquivalenceClasses.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,14 @@ template <class ElemTy> class EquivalenceClasses {
234234
// all other elements in same class to be the successor element.
235235
if (Cur->isLeader() && Next) {
236236
Next->Leader = Cur->Leader;
237-
Next->Next = (const ECValue *)((intptr_t)Next->Next | (intptr_t)1);
237+
Next->Next = reinterpret_cast<const ECValue *>(
238+
reinterpret_cast<intptr_t>(Next->Next) | static_cast<intptr_t>(1));
239+
238240
const ECValue *newLeader = Next;
239241
while ((Next = Next->getNext())) {
240242
Next->Leader = newLeader;
241243
}
242-
} else {
244+
} else if (!Cur->isLeader()) {
243245
const ECValue *Leader = findLeader(V).Node;
244246
const ECValue *Pre = Leader;
245247
while (Pre->getNext() != Cur) {
@@ -254,8 +256,9 @@ template <class ElemTy> class EquivalenceClasses {
254256
} else {
255257
// If the current element is in the middle of class, then simply
256258
// connect the predecessor element and the successor element.
257-
Pre->Next =
258-
(const ECValue *)((intptr_t)Next | (intptr_t)Pre->isLeader());
259+
Pre->Next = reinterpret_cast<const ECValue *>(
260+
reinterpret_cast<intptr_t>(Next) |
261+
static_cast<intptr_t>(Pre->isLeader()));
259262
Next->Leader = Pre;
260263
}
261264
}

0 commit comments

Comments
 (0)