Skip to content

Commit

Permalink
Fix function names
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Jun 20, 2024
1 parent 8880839 commit 8cc8329
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/bitarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ static inline size_t number_of_blocks(size_t N) {
return NR_BLOCKS_LOOKUP[N];
}

static inline size_t remainder(size_t N) {
static inline size_t remainder_lookup(size_t N) {
DIGRAPHS_ASSERT(N < LOOKUP_SIZE);
return REMAINDER_LOOKUP[N];
}

static inline size_t quotient(size_t N) {
static inline size_t quotient_lookup(size_t N) {
DIGRAPHS_ASSERT(N < LOOKUP_SIZE);
return QUOTIENT_LOOKUP[N];
}

static inline Block mask(size_t N) {
static inline Block mask_lookup(size_t N) {
DIGRAPHS_ASSERT(N < NUMBER_BITS_PER_BLOCK);
return MASK_LOOKUP[N];
}
Expand Down Expand Up @@ -93,9 +93,11 @@ set_bit_array(BitArray* const bit_array, uint16_t const pos, bool const val) {
DIGRAPHS_ASSERT(bit_array != NULL);
DIGRAPHS_ASSERT(pos < bit_array->nr_bits);
if (val) {
bit_array->blocks[quotient(pos)] |= mask(remainder(pos));
bit_array->blocks[quotient_lookup(pos)] |=
mask_lookup(remainder_lookup(pos));
} else {
bit_array->blocks[quotient(pos)] &= ~mask(remainder(pos));
bit_array->blocks[quotient_lookup(pos)] &=
~mask_lookup(remainder_lookup(pos));
}
}

Expand All @@ -105,7 +107,8 @@ static inline bool get_bit_array(BitArray const* const bit_array,
uint16_t const pos) {
DIGRAPHS_ASSERT(bit_array != NULL);
DIGRAPHS_ASSERT(pos < bit_array->nr_bits);
return bit_array->blocks[quotient(pos)] & mask(remainder(pos));
return bit_array->blocks[quotient_lookup(pos)]
& mask_lookup(remainder_lookup(pos));
}

//! Intersect the BitArray's pointed to by \p bit_array1 and \p bit_array2. The
Expand Down

0 comments on commit 8cc8329

Please sign in to comment.