From 0abf6a1ecff93d9a95bfe59d29f6d75c028cc14a Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 12 Sep 2024 17:12:41 -0700 Subject: [PATCH] Improve Node3 search codegen --- ConflictSet.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 495da63..b05d105 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -766,6 +766,8 @@ private: int getNodeIndex(Node3 *self, uint8_t index) { Node3 *n = (Node3 *)self; + assume(n->numChildren >= 1); + assume(n->numChildren <= 3); for (int i = 0; i < n->numChildren; ++i) { if (n->index[i] == index) { return i; @@ -1070,6 +1072,8 @@ ChildAndMaxVersion getChildAndMaxVersion(Node *self, uint8_t index) { Node *getChildGeq(Node0 *, int) { return nullptr; } Node *getChildGeq(Node3 *n, int child) { + assume(n->numChildren >= 1); + assume(n->numChildren <= 3); for (int i = 0; i < n->numChildren; ++i) { if (n->index[i] >= child) { return n->children[i];