diff options
| author | Chi-Kuan Chiu <105687635+devarajabc@users.noreply.github.com> | 2025-08-06 05:43:12 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-05 23:43:12 +0200 |
| commit | dd7b99ffd1445d824bd351488c6f7b976f77fc9e (patch) | |
| tree | c09ad600c988cac9bccb266693cc298f4c5fde6c /src/include/callback.h | |
| parent | f82c5440b7b01fcc31254a76941e338a47dc5ace (diff) | |
| download | box64-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/callback.h')
0 files changed, 0 insertions, 0 deletions