diff options
Diffstat (limited to 'zix/bitset.h')
-rw-r--r-- | zix/bitset.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/zix/bitset.h b/zix/bitset.h index 5214669..68dd344 100644 --- a/zix/bitset.h +++ b/zix/bitset.h @@ -49,50 +49,58 @@ typedef uint8_t ZixBitsetTally; /** The number of bitset elements needed for the given number of bits. */ -#define ZIX_BITSET_ELEMS(n_bits) \ - (((n_bits) / ZIX_BITSET_BITS_PER_ELEM) + \ - ((n_bits) % ZIX_BITSET_BITS_PER_ELEM ? 1 : 0)) +#define ZIX_BITSET_ELEMS(n_bits) \ + (((n_bits) / ZIX_BITSET_BITS_PER_ELEM) + \ + ((n_bits) % ZIX_BITSET_BITS_PER_ELEM ? 1 : 0)) /** Clear a Bitset. */ -ZIX_API void +ZIX_API +void zix_bitset_clear(ZixBitset* b, ZixBitsetTally* t, size_t n_bits); /** Set bit `i` in `t` to 1. */ -ZIX_API void +ZIX_API +void zix_bitset_set(ZixBitset* b, ZixBitsetTally* t, size_t i); /** Clear bit `i` in `t` (set to 0). */ -ZIX_API void +ZIX_API +void zix_bitset_reset(ZixBitset* b, ZixBitsetTally* t, size_t i); /** Return the `i`th bit in `t`. */ -ZIX_PURE_API bool +ZIX_PURE_API +bool zix_bitset_get(const ZixBitset* b, size_t i); /** Return the number of set bits in `b` up to bit `i` (non-inclusive). */ -ZIX_PURE_API size_t +ZIX_PURE_API +size_t zix_bitset_count_up_to(const ZixBitset* b, const ZixBitsetTally* t, size_t i); /** Return the number of set bits in `b` up to bit `i` (non-inclusive) if bit `i` is set, or (size_t)-1 otherwise. */ -ZIX_PURE_API size_t -zix_bitset_count_up_to_if(const ZixBitset* b, const ZixBitsetTally* t, size_t i); +ZIX_PURE_API +size_t +zix_bitset_count_up_to_if(const ZixBitset* b, + const ZixBitsetTally* t, + size_t i); /** @} @} */ -#endif /* ZIX_BITSET_H */ +#endif /* ZIX_BITSET_H */ |