+/**
+ * Check if two bitsets intersect.
+ * @param a The first bitset.
+ * @param b The second bitset.
+ * @return 1 if they have a bit in common, 0 if not.
+ */
+static inline bool bitset_intersect(const bitset_t *a, const bitset_t *b)
+{
+ assert(a->size == b->size);
+ return rbitsets_have_common(a->data, b->data, a->size);
+}
+
+/**
+ * set or clear all bits in the range [from;to[.
+ * @param a The bitset.
+ * @param from The first index to set to one.
+ * @param to The last index plus one to set to one.
+ * @param do_set If 1 the bits are set, if 0, they are cleared.
+ */
+static inline void bitset_mod_range(bitset_t *a, size_t from, size_t to,
+ bool do_set)
+{
+ if (from == to)
+ return;
+
+ if (to < from) {
+ size_t tmp = from;
+ from = to;
+ to = tmp;
+ }
+
+ if (to > a->size)
+ to = a->size;
+
+ rbitset_set_range(a->data, from, to, do_set);
+}
+
+#define bitset_set_range(bs, from, to) bitset_mod_range((bs), (from), (to), 1)
+#define bitset_clear_range(bs, from, to) bitset_mod_range((bs), (from), (to), 0)
+
+/**
+ * Check, if a bitset is empty.
+ * @param a The bitset.
+ * @return 1, if the bitset is empty, 0 if not.
+ */
+static inline bool bitset_is_empty(const bitset_t *bs)
+{
+ return rbitset_is_empty(bs->data, bs->size);
+}
+
+/**
+ * Print a bitset to a stream.
+ * The bitset is printed as a comma separated list of bits set.
+ * @param file The stream.
+ * @param bs The bitset.