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

Implement access rank select operators #51

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

kitsuyui
Copy link
Owner

Implementation of #50 .

  • access: Access the specified position in the bit sequence and get the value of the bit.
  • rank: Count how many times a specific bit appears up to the specified position.
    • rank_0(i): Count how many times 0 appears up to the i-th position.
    • rank_1(i): Count how many times 1 appears up to the i-th position.
    • rank(i, bit): Count how many times bit appears up to the i-th position.
    • rank_range_0(i, j): Count how many times 0 appears between the i-th and j-th positions.
    • rank_range_1(i, j): Count how many times 1 appears between the i-th and j-th positions.
    • rank_range(i, j, bit): Count how many times bit appears between the i-th and j-th positions.
  • select: Find the position where the specified number of bits appear.
    • select_0(k): Find the position where the k-th 0 appears.
    • select_1(k): Find the position where the k-th 1 appears.
    • select(k, bit): Find the position where the k-th bit appears.

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (14e7652) to head (2ace204).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main       #51    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            3         3            
  Lines          889       994   +105     
==========================================
+ Hits           889       994   +105     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kitsuyui kitsuyui force-pushed the implement-access-rank-select-operators branch from 9349d27 to 3578737 Compare November 11, 2024 08:04
Implementation of #50 .

- access: Access the specified position in the bit sequence and get the value of the bit.
- rank: Count how many times a specific bit appears up to the specified position.
  - rank_0(i): Count how many times 0 appears up to the i-th position.
  - rank_1(i): Count how many times 1 appears up to the i-th position.
  - rank(i, bit): Count how many times bit appears up to the i-th position.
  - rank_range_0(i, j): Count how many times 0 appears between the i-th and j-th positions.
  - rank_range_1(i, j): Count how many times 1 appears between the i-th and j-th positions.
  - rank_range(i, j, bit): Count how many times bit appears between the i-th and j-th positions.
- select: Find the position where the specified number of bits appear.
  - select_0(k): Find the position where the k-th 0 appears.
  - select_1(k): Find the position where the k-th 1 appears.
  - select(k, bit): Find the position where the k-th bit appears.
@kitsuyui kitsuyui force-pushed the implement-access-rank-select-operators branch from 3578737 to 2ace204 Compare November 11, 2024 08:20
@kitsuyui kitsuyui merged commit 8eaf67d into main Nov 11, 2024
11 checks passed
@kitsuyui kitsuyui deleted the implement-access-rank-select-operators branch November 11, 2024 08:21
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

Successfully merging this pull request may close these issues.

1 participant