Added node info dump callbacks
[libfirm] / ir / adt / bitset.h
index ae9d8a4..d49eb65 100644 (file)
 #include "firm_config.h"
 #include "bitfiddle.h"
 
+#ifdef _WIN32
+#include <malloc.h>
+#else
+#include <alloca.h>
+#endif
+
 typedef unsigned int bitset_pos_t;
 
 #include "bitset_std.h"
@@ -60,7 +66,7 @@ static INLINE bitset_t *_bitset_prepare(void *area, bitset_pos_t size)
        bitset_t *ptr = area;
        memset(area, 0, _bitset_overall_size(sizeof(bitset_t), size));
        ptr->units = _bitset_units(size);
-  ptr->size = size;
+       ptr->size = size;
        ptr->data = _bitset_data_ptr(area, sizeof(bitset_t), size);
        return ptr;
 }
@@ -109,7 +115,7 @@ static INLINE bitset_t *_bitset_mask_highest(bitset_t *bs)
  * @return A pointer to an empty initialized bitset.
  */
 #define bitset_malloc(size) \
-       _bitset_prepare(malloc(_bitset_overall_size(sizeof(bitset_t), size)), size)
+       _bitset_prepare(xmalloc(_bitset_overall_size(sizeof(bitset_t), size)), size)
 
 /**
  * Free a bitset allocated with bitset_malloc().
@@ -267,7 +273,7 @@ static INLINE bitset_pos_t _bitset_next(const bitset_t *bs,
 {
        bitset_pos_t unit_number = pos / BS_UNIT_SIZE_BITS;
 
-       if(unit_number >= bs->units)
+       if(pos >= bs->size)
                return -1;
 
        {