+/*
+ * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief ANSI-C compliant implementation of bitsets
+ * @version $Id$
+ */
+#ifndef FIRM_ADT_BITSET_STD_H
+#define FIRM_ADT_BITSET_STD_H
+
+#include "bitfiddle.h"
/** Use ordinary ints as unit types. */
typedef unsigned int bitset_unit_t;
* @param unit A pointer to the unit.
* @param bit which bit to set.
*/
-#define _bitset_inside_flip(unit_ptr,bit) (*unit_ptr) ^= ~(1 << (bit))
+#define _bitset_inside_flip(unit_ptr,bit) (*unit_ptr) ^= (1 << (bit))
/**
* Flip a whole unit.
* @return The Number of leading zeroes.
*/
#define _bitset_inside_ntz(unit_ptr) _bitset_std_inside_ntz(unit_ptr)
-static INLINE bitset_pos_t _bitset_std_inside_ntz(bitset_unit_t *unit_ptr)
+static INLINE unsigned _bitset_std_inside_ntz(bitset_unit_t *unit_ptr)
{
unsigned long data = *unit_ptr;
- return 32 - (bitset_pos_t) nlz(~data & (data - 1));
+ return 32 - (unsigned) nlz(~data & (data - 1));
}
/**
#define _bitset_inside_binop_andnot(tgt,src) ((*tgt) &= ~(*src))
#define _bitset_inside_binop_or(tgt,src) ((*tgt) |= (*src))
#define _bitset_inside_binop_xor(tgt,src) ((*tgt) ^= (*src))
+
+#endif