Skip to content

Commit

Permalink
Cleanups to ART
Browse files Browse the repository at this point in the history
* Change art_compare_prefix to take a single length rather than two.
* Use art_compare_keys where possible.
* Use art_val_t directly (through an alias) rather than defining a separate
  type.
* Remove key_chunk from art_indexed_child_t.
* Use node->base where possible.
* Merge art_create_iterator into art_init_iterator.
  • Loading branch information
SLieve committed Jan 7, 2024
1 parent e80d89d commit ca48de0
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 178 deletions.
16 changes: 6 additions & 10 deletions include/roaring/art/art.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace internal {
#endif

typedef uint8_t art_key_chunk_t;
typedef void art_node_t;
typedef struct art_node_s art_node_t;

/**
* Wrapper to allow an empty tree.
Expand All @@ -50,7 +50,7 @@ typedef struct art_s {
* contains the key corresponding to the value.
*/
typedef struct art_val_s {
art_key_chunk_t _pad[ART_KEY_BYTES];
art_key_chunk_t key[ART_KEY_BYTES];
} art_val_t;

/**
Expand Down Expand Up @@ -121,15 +121,11 @@ typedef struct art_iterator_s {
} art_iterator_t;

/**
* Creates an iterator. Must be initialized through `art_init_iterator` first.
*/
art_iterator_t art_create_iterator();

/**
* Moves the iterator to the first or last entry in the ART, depending on
* `first`.
* Creates an iterator initialzed to the first or last entry in the ART,
* depending on `first`. The iterator is not valid if there are no entries in
* the ART.
*/
void art_init_iterator(const art_t *art, art_iterator_t *iterator, bool first);
art_iterator_t art_init_iterator(const art_t *art, bool first);

/**
* Returns an initialized iterator positioned at a key equal to or greater than
Expand Down
2 changes: 1 addition & 1 deletion include/roaring/roaring64.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ typedef struct roaring64_leaf_s roaring64_leaf_t;
* contexts associated with that bitmap.
*/
typedef struct roaring64_bulk_context_s {
uint8_t high_bytes[ART_KEY_BYTES];
uint8_t high_bytes[6];
uint16_t low_bytes;
roaring64_leaf_t *leaf;
} roaring64_bulk_context_t;
Expand Down
Loading

0 comments on commit ca48de0

Please sign in to comment.