MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / zslIsInRange

Function zslIsInRange

src/t_zset.cpp:312–326  ·  view source on GitHub ↗

Returns if there is a part of the zset is in range. */

Source from the content-addressed store, hash-verified

310
311/* Returns if there is a part of the zset is in range. */
312int zslIsInRange(zskiplist *zsl, zrangespec *range) {
313 zskiplistNode *x;
314
315 /* Test for ranges that will always be empty. */
316 if (range->min > range->max ||
317 (range->min == range->max && (range->minex || range->maxex)))
318 return 0;
319 x = zsl->tail;
320 if (x == NULL || !zslValueGteMin(x->score,range))
321 return 0;
322 x = zsl->header->level(0)->forward;
323 if (x == NULL || !zslValueLteMax(x->score,range))
324 return 0;
325 return 1;
326}
327
328/* Find the first node that is contained in the specified range.
329 * Returns NULL when no element is contained in the range. */

Callers 2

zslFirstInRangeFunction · 0.85
zslLastInRangeFunction · 0.85

Calls 3

zslValueGteMinFunction · 0.85
zslValueLteMaxFunction · 0.85
levelMethod · 0.80

Tested by

no test coverage detected