Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range_search_2d is faster now for counting queries #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/sdsl/wt_int.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@ class wt_int
size_type irb = ilb + (1ULL << (m_max_level-level));
size_type mid = (irb + ilb)>>1;

// the current range is [ilb,irb); thus, if it is entirely within the query range
// *and* no reporting is needed, we can simply take all the items and return
if ( not report and (vlb <= ilb and irb-1 <= vrb) ) {
cnt_answers+= (rb-lb+1);
return ;
}

size_type offset = offsets[level];

size_type ones_before_o = m_tree_rank(offset);
Expand Down