/*
- * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
/**
* Allocate an empty raw bitset on the heap.
*
- * @param size element size of the bitset
+ * @param size number of bits in the bitset
*
* @return the new bitset
*/
* Allocate an empty raw bitset on the stack.
*
* @param res will contain the newly allocated bitset
- * @param size element size of the bitset
+ * @param size number of bits in the bitset
*/
#define rbitset_alloca(res, size) \
do { \
* Allocate an empty raw bitset on an obstack.
*
* @param obst the obstack where the bitset is allocated on
- * @param size element size of the bitset
+ * @param size number of bits in the bitset
*
* @return the new bitset
*/
* The size of this bitset can be accessed by bitset[-1].
*
* @param obst the obstack where the bitset is allocated on
- * @param size element size of the bitset
+ * @param size number of bits in the bitset
*
* @return the new bitset
*/
*
* @param obst the obstack where the bitset is allocated on
* @param old_bitset the bitset to be duplicated
- * @param size element size of the bitset
+ * @param size number of bits in the bitset
*
* @return the new bitset
*/
BITSET_ELEM(bitset, pos) &= ~(1 << (pos % BITS_PER_ELEM));
}
+/**
+ * Clear all bits in a given bitset.
+ *
+ * @param bitset the bitset
+ * @param size number of bits in the bitset
+ */
+static INLINE void rbitset_clear_all(unsigned *bitset, unsigned size) {
+ unsigned size_bytes = BITSET_SIZE_BYTES(size);
+ memset(bitset, 0, size_bytes);
+}
+
/**
* Check if a bit is set at position pos.
*
}
}
+static INLINE int rbitset_equal(const unsigned *bitset1,
+ const unsigned *bitset2, size_t size)
+{
+ unsigned i, n = BITSET_SIZE_ELEMS(size);
+
+ for(i = 0; i < n; ++i) {
+ if(bitset1[i] != bitset2[i])
+ return 0;
+ }
+ return 1;
+}
+
/**
* Copy a raw bitset into an bitset.
*