summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-07-08 09:48:43 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-07-08 09:49:38 -0700
commit68e3802b238b964900acac9422a70e295482243f (patch)
tree31fe313828151dcc7f910082413c4e4a52fa6a49 /include
parentc341ad7300afa3f71db5cd9813bbeebf32f9195b (diff)
downloadnasm-68e3802b238b964900acac9422a70e295482243f.tar.gz
rbtree: add rb_search_exact()HEADmaster
Sometimes we want to search for an exact key only, and reject the case when tree->key < key. Add rb_search_exact() for this purpose, rather than forcing the caller to perform the comparison in open code. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/rbtree.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/rbtree.h b/include/rbtree.h
index 332f6f85..39d45aff 100644
--- a/include/rbtree.h
+++ b/include/rbtree.h
@@ -73,6 +73,11 @@ struct rbtree *rb_insert(struct rbtree *, struct rbtree *);
struct rbtree *rb_search(const struct rbtree *, uint64_t);
/*
+ * Find a node in the tree exactly matching the key value.
+ */
+struct rbtree *rb_search_exact(const struct rbtree *, uint64_t);
+
+/*
* Return the immediately previous or next node in key order.
* Returns NULL if this node is the end of the tree.
* These operations are safe for complee (but not partial!)