Last active
June 11, 2020 13:17
-
-
Save ayende/c3c0208e86a1fceb6c51ef8df8c49f15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct range_finder { | |
// input | |
uint64_t *bitmap; | |
size_t bitmap_size; | |
size_t size_required; | |
size_t index; | |
// output | |
size_t size_available; | |
size_t selected_position; | |
// the current word we are working on | |
uint64_t current; | |
// state | |
uint64_t current_set_bit; | |
uint64_t previous_set_bit; | |
}; | |
static void init_range(uint64_t *bitmap, size_t bitmap_size, | |
size_t size_required, | |
struct range_finder *restrict range); | |
static bool find_next(struct range_finder *restrict range); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment