X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=map%2Fskiplist.c;fp=map%2Fskiplist.c;h=49ef21b3d32bcfe43c0e38cfdad883be1994eda5;hp=52d7f1a622a40242029e0e15cf273b3b875970a4;hb=f7a1c10d18dcc2654d0c9b1f5ffc9f4ec9b23776;hpb=b0f5164fac83e2ad24ab1f56d5c1f022279372ab diff --git a/map/skiplist.c b/map/skiplist.c index 52d7f1a..49ef21b 100644 --- a/map/skiplist.c +++ b/map/skiplist.c @@ -231,6 +231,17 @@ uint64_t sl_lookup (skiplist_t *sl, void *key) { return DOES_NOT_EXIST; } +void *sl_min_key (skiplist_t *sl) { + node_t *item = sl->head->next[0]; + while (item != NULL) { + node_t *next = item->next[0]; + if (!IS_TAGGED(next)) + return item->key; + item = (node_t *)STRIP_TAG(next); + } + return DOES_NOT_EXIST; +} + uint64_t sl_cas (skiplist_t *sl, void *key, uint64_t expectation, uint64_t new_val) { TRACE("s1", "sl_cas: key %p skiplist %p", key, sl); TRACE("s1", "sl_cas: expectation %p new value %p", expectation, new_val);