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

How to use containsRange in roaring64 #597

Closed
MochiXu opened this issue Feb 19, 2024 · 1 comment
Closed

How to use containsRange in roaring64 #597

MochiXu opened this issue Feb 19, 2024 · 1 comment

Comments

@MochiXu
Copy link

MochiXu commented Feb 19, 2024

It seems that roaring64 doesn't have function containsRange.
Could you please give me some suggestions about how to use containsRange in roaring64?

  /**
   * Check if all values from x (included) to y (excluded) are present
   */
  bool containsRange(const uint64_t x, const uint64_t y) const noexcept {
      return api::roaring_bitmap_contains_range(&roaring, x, y);
  }
@SLieve
Copy link
Contributor

SLieve commented Feb 19, 2024

Roaring64Map internally uses a std::map of uint32_t for the high 32 bits of values, to a 32-bit Roaring bitmap containing the low 32 bits of values with the associated high 32 bits. This means that using roaring_bitmap_contains_range will only determine whether a specific 32-bit Roaring bitmap contains a given 32-bit range.

To determine whether a 64-bit range is fully present in the Roaring64Map, we would need to loop over all different high 32 bits of the range, and check the corresponding 32-bit Roaring bitmaps for subranges. See a similar implementation here.

@MochiXu MochiXu closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants