From cafa540fc8dbcdda406956c08f9941da985ffdef Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 10 Oct 2024 10:24:38 -0700 Subject: [PATCH] Return tagged pointer from getChild --- ConflictSet.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 058838a..5a03fc4 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -1104,22 +1104,24 @@ void setMaxVersion(Node *n, InternalVersionT newMax) { TaggedNodePointer &getInTree(Node *n, ConflictSet::Impl *); -Node *getChild(Node0 *, uint8_t) { return nullptr; } -Node *getChild(Node3 *self, uint8_t index) { +TaggedNodePointer getChild(Node0 *, uint8_t) { return nullptr; } +TaggedNodePointer getChild(Node3 *self, uint8_t index) { int i = getNodeIndex(self, index); return i < 0 ? nullptr : self->children[i]; } -Node *getChild(Node16 *self, uint8_t index) { +TaggedNodePointer getChild(Node16 *self, uint8_t index) { int i = getNodeIndex(self, index); return i < 0 ? nullptr : self->children[i]; } -Node *getChild(Node48 *self, uint8_t index) { +TaggedNodePointer getChild(Node48 *self, uint8_t index) { int i = self->index[index]; return i < 0 ? nullptr : self->children[i]; } -Node *getChild(Node256 *self, uint8_t index) { return self->children[index]; } +TaggedNodePointer getChild(Node256 *self, uint8_t index) { + return self->children[index]; +} -Node *getChild(Node *self, uint8_t index) { +TaggedNodePointer getChild(Node *self, uint8_t index) { switch (self->getType()) { case Type_Node0: return getChild(static_cast(self), index); @@ -2579,7 +2581,7 @@ bool checkRangeStartsWith(Node *n, std::span key, int begin, return checkMaxBetweenExclusive(n, begin, end, readVersion, tls); } - auto *child = getChild(n, remaining[0]); + Node *child = getChild(n, remaining[0]); if (child == nullptr) { auto c = getChildGeq(n, remaining[0]); if (c != nullptr) { @@ -2746,7 +2748,7 @@ bool checkRangeRightSide(Node *n, std::span key, int prefixLen, return false; } - auto *child = getChild(n, remaining[0]); + Node *child = getChild(n, remaining[0]); if (child == nullptr) { auto c = getChildGeq(n, remaining[0]); if (c != nullptr) { @@ -3160,7 +3162,7 @@ Node *firstGeqPhysical(Node *n, const std::span key) { return n; } - auto *child = getChild(n, remaining[0]); + Node *child = getChild(n, remaining[0]); if (child == nullptr) { auto c = getChildGeq(n, remaining[0]); if (c != nullptr) { @@ -3612,7 +3614,7 @@ Node *firstGeqLogical(Node *n, const std::span key) { goto downLeftSpine; } - auto *child = getChild(n, remaining[0]); + Node *child = getChild(n, remaining[0]); if (child == nullptr) { auto c = getChildGeq(n, remaining[0]); if (c != nullptr) {