about summary refs log tree commit diff stats
path: root/src/include/pathcoll.h
diff options
context:
space:
mode:
authorChi-Kuan Chiu <105687635+devarajabc@users.noreply.github.com>2025-08-06 05:43:12 +0800
committerGitHub <noreply@github.com>2025-08-05 23:43:12 +0200
commitdd7b99ffd1445d824bd351488c6f7b976f77fc9e (patch)
treec09ad600c988cac9bccb266693cc298f4c5fde6c /src/include/pathcoll.h
parentf82c5440b7b01fcc31254a76941e338a47dc5ace (diff)
downloadbox64-dd7b99ffd1445d824bd351488c6f7b976f77fc9e.tar.gz
box64-dd7b99ffd1445d824bd351488c6f7b976f77fc9e.zip
Add O(1) early-out to eusing cached bounds (#2901)
Add a fast-path in rb_get() and rb_get_64() that checks the tree’s
cached leftmost->start and rightmost->end bounds before calling
find_addr(). If the query address lies outside the address bounds,
we return 0 immediately, avoiding an unnecessary tree walk.

This mirrors the idea used in jserv/rbtree’s rb_cached_contains(),
using cached min/max to short-circuit lookups.

Behavior is unchanged (both functions still return 0 when not found);
only negative lookups become cheaper.

Co-authored-by: Jim Huang <jserv@ccns.ncku.edu.tw>
Diffstat (limited to 'src/include/pathcoll.h')
0 files changed, 0 insertions, 0 deletions