+ uint8_t bit = idx % 8;
+
+ return (bitx->array[page] & BV(bit));
+}
+
+/**
+ * Check if the bitarray is full
+ *
+ * Only \a bitarray_len bits are tested.
+ */
+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.
+ */
+INLINE bool bitarray_isRangeFull(BitArray *bitx, int idx, int offset)
+{
+ ASSERT((size_t)(idx + offset) <= bitx->bitarray_len);
+
+ for (int i = idx; i <= idx + offset; i++)
+ if (!bitarray_test(bitx, i))
+ return 0;
+
+ return 1;
+}