From 23527a3d2b725a4f3876125e5f663540ab411e92 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sun, 22 Jan 2023 11:53:33 +0700 Subject: [PATCH v22 15/22] Get rid of FIXED_NODE_HAS_FREE_SLOT It's only used in one assert for the node256 kind, whose fanout is necessarily fixed, and we already have a convenient macro to compare that with. --- src/include/lib/radixtree.h | 3 --- src/include/lib/radixtree_insert_impl.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/include/lib/radixtree.h b/src/include/lib/radixtree.h index d48c915373..8fbc0b5086 100644 --- a/src/include/lib/radixtree.h +++ b/src/include/lib/radixtree.h @@ -374,8 +374,6 @@ typedef struct RT_NODE #define NODE_IS_LEAF(n) (((RT_PTR_LOCAL) (n))->shift == 0) #define VAR_NODE_HAS_FREE_SLOT(node) \ ((node)->base.n.count < (node)->base.n.fanout) -#define FIXED_NODE_HAS_FREE_SLOT(node, class) \ - ((node)->base.n.count < RT_SIZE_CLASS_INFO[class].fanout) /* Base type of each node kinds for leaf and inner nodes */ /* The base types must be a be able to accommodate the largest size @@ -2262,7 +2260,6 @@ RT_DUMP(RT_RADIX_TREE *tree) /* locally declared macros */ #undef NODE_IS_LEAF #undef VAR_NODE_HAS_FREE_SLOT -#undef FIXED_NODE_HAS_FREE_SLOT #undef RT_NODE_KIND_COUNT #undef RT_SIZE_CLASS_COUNT #undef RT_RADIX_TREE_MAGIC diff --git a/src/include/lib/radixtree_insert_impl.h b/src/include/lib/radixtree_insert_impl.h index 8470c8fc70..b484b7a099 100644 --- a/src/include/lib/radixtree_insert_impl.h +++ b/src/include/lib/radixtree_insert_impl.h @@ -286,7 +286,7 @@ #else chunk_exists = RT_NODE_INNER_256_IS_CHUNK_USED(n256, chunk); #endif - Assert(chunk_exists || FIXED_NODE_HAS_FREE_SLOT(n256, RT_CLASS_256)); + Assert(chunk_exists || node->count < RT_NODE_MAX_SLOTS); #ifdef RT_NODE_LEVEL_LEAF RT_NODE_LEAF_256_SET(n256, chunk, value); -- 2.39.0