+/**
+ * Check if the bitarray is full
+ *
+ * Only \a bitarray_len bits are tested.
+ *
+ * \param bitx BitArray to test
+ * \return True if \a bitx is full, false otherwise
+ */
+INLINE bool bitarray_isFull(BitArray *bitx)
+{
+ // test full bytes except the last one
+ for (size_t page = 0; page <= bitx->size - 2; page++)
+ {
+ if (!(bitx->array[page] == 0xff))
+ return 0;
+ }
+ // test the last byte using the correct bitmask
+ uint8_t mask = BV(bitx->bitarray_len >> 3) - 1;
+ if (!(bitx->array[bitx->size - 1] & mask))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * Ugly!.. reformat it.
+ */
+/**
+ * Test if a range of bit is full.
+ *
+ * \param bitx BitArray context
+ * \param idx Starting bit
+ * \param offset Number of bits to test
+ * \return True if range is full, false otherwise
+ */
+INLINE bool bitarray_isRangeFull(BitArray *bitx, int idx, int offset)