diff --git a/ConflictSet.cpp b/ConflictSet.cpp index af35ec3..3a200ae 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -242,6 +242,8 @@ constexpr int kNodeCopySize = // children's parent pointers. The caller must then insert the new node into the // tree. +using MaxVersionT = int64_t; + struct Node0 : Node { constexpr static auto kType = Type_Node0; uint8_t *partialKey() { return (uint8_t *)(this + 1); } @@ -258,7 +260,7 @@ struct Node3 : Node { // Sorted uint8_t index[kMaxNodes]; Node *children[kMaxNodes]; - int64_t childMaxVersion[kMaxNodes]; + MaxVersionT childMaxVersion[kMaxNodes]; uint8_t *partialKey() { return (uint8_t *)(this + 1); } void copyChildrenAndKeyFrom(const Node0 &other); @@ -274,7 +276,7 @@ struct Node16 : Node { // Sorted uint8_t index[kMaxNodes]; Node *children[kMaxNodes]; - int64_t childMaxVersion[kMaxNodes]; + MaxVersionT childMaxVersion[kMaxNodes]; uint8_t *partialKey() { return (uint8_t *)(this + 1); } void copyChildrenAndKeyFrom(const Node3 &other); @@ -291,13 +293,13 @@ struct Node48 : Node { int8_t nextFree; int8_t index[256]; Node *children[kMaxNodes]; - int64_t childMaxVersion[kMaxNodes]; + MaxVersionT childMaxVersion[kMaxNodes]; uint8_t reverseIndex[kMaxNodes]; constexpr static int kMaxOfMaxPageSize = 16; constexpr static int kMaxOfMaxShift = std::countr_zero(uint32_t(kMaxOfMaxPageSize)); constexpr static int kMaxOfMaxTotalPages = kMaxNodes / kMaxOfMaxPageSize; - int64_t maxOfMax[kMaxOfMaxTotalPages]; + MaxVersionT maxOfMax[kMaxOfMaxTotalPages]; uint8_t *partialKey() { return (uint8_t *)(this + 1); } @@ -312,12 +314,12 @@ struct Node256 : Node { constexpr static auto kType = Type_Node256; BitSet bitSet; Node *children[256]; - int64_t childMaxVersion[256]; + MaxVersionT childMaxVersion[256]; constexpr static int kMaxOfMaxPageSize = 16; constexpr static int kMaxOfMaxShift = std::countr_zero(uint32_t(kMaxOfMaxPageSize)); constexpr static int kMaxOfMaxTotalPages = 256 / kMaxOfMaxPageSize; - int64_t maxOfMax[kMaxOfMaxTotalPages]; + MaxVersionT maxOfMax[kMaxOfMaxTotalPages]; uint8_t *partialKey() { return (uint8_t *)(this + 1); } void copyChildrenAndKeyFrom(const Node48 &other); void copyChildrenAndKeyFrom(const Node256 &other); @@ -1710,7 +1712,7 @@ downLeftSpine: } // Returns true if all in-bounds vs are <= readVersion -bool scan16(const int64_t *vs, const uint8_t *is, int begin, int end, +bool scan16(const MaxVersionT *vs, const uint8_t *is, int begin, int end, int64_t readVersion) { assert(end - begin < 256); @@ -2798,16 +2800,16 @@ void setMaxVersion(Node *n, ConflictSet::Impl *impl, int64_t newMax) { assert(n48->bitSet.test(index)); int i = n48->index[index]; n48->childMaxVersion[i] = newMax; - n48->maxOfMax[i >> Node48::kMaxOfMaxShift] = - std::max(n48->maxOfMax[i >> Node48::kMaxOfMaxShift], newMax); + n48->maxOfMax[i >> Node48::kMaxOfMaxShift] = std::max( + n48->maxOfMax[i >> Node48::kMaxOfMaxShift], newMax); return; } case Type_Node256: { auto *n256 = static_cast(n); assert(n256->bitSet.test(index)); n256->childMaxVersion[index] = newMax; - n256->maxOfMax[index >> Node256::kMaxOfMaxShift] = - std::max(n256->maxOfMax[index >> Node256::kMaxOfMaxShift], newMax); + n256->maxOfMax[index >> Node256::kMaxOfMaxShift] = std::max( + n256->maxOfMax[index >> Node256::kMaxOfMaxShift], newMax); return; } default: // GCOVR_EXCL_LINE