add missing dbg hooks for boolean simplifications
[libfirm] / include / libfirm / adt / bitfiddle.h
index 6716978..a5ef652 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
  *
 #ifndef FIRM_ADT_BITFIDDLE_H
 #define FIRM_ADT_BITFIDDLE_H
 
+#include "firm_config.h"
+
 #include <limits.h>
 #include <assert.h>
-#include "util.h"
+#include "compiler.h"
 
 /* some functions here assume ints are 32 bit wide */
 #define HACKDEL_WORDSIZE 32
@@ -44,7 +46,7 @@ COMPILETIME_ASSERT(UINT_MAX == 4294967295U, uintmax)
  *
  * @note See hacker's delight, page 27.
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 int add_saturated(int x, int y)
 {
        int sum      = x + y;
@@ -73,7 +75,7 @@ int add_saturated(int x, int y)
  * @param x A 32-bit word.
  * @return The number of bits set in x.
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 unsigned popcnt(unsigned x) {
        x -= ((x >> 1) & 0x55555555);
        x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
@@ -88,7 +90,7 @@ unsigned popcnt(unsigned x) {
  * @param x The word.
  * @return The number of leading (from the most significant bit) zeros.
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 unsigned nlz(unsigned x) {
 #ifdef USE_X86_ASSEMBLY
        unsigned res;
@@ -117,7 +119,7 @@ unsigned nlz(unsigned x) {
  * @param x The word.
  * @return The number of trailing zeros.
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 unsigned ntz(unsigned x) {
 #ifdef USE_X86_ASSEMBLY
        unsigned res;
@@ -161,7 +163,7 @@ unsigned ntz(unsigned x) {
  * Returns the biggest power of 2 that is equal or smaller than @p x
  * (see hackers delight power-of-2 boundaries, page 48)
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 unsigned floor_po2(unsigned x)
 {
 #ifdef USE_X86_ASSEMBLY // in this case nlz is fast
@@ -184,7 +186,7 @@ unsigned floor_po2(unsigned x)
  * @remark x has to be <= 0x8000000 of course
  * @note see hackers delight power-of-2 boundaries, page 48
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 unsigned ceil_po2(unsigned x)
 {
        if(x == 0)
@@ -208,7 +210,7 @@ unsigned ceil_po2(unsigned x)
 /**
  * Tests whether @p x is a power of 2
  */
-static INLINE __attribute__((const))
+static INLINE PURE
 int is_po2(unsigned x)
 {
        return (x & (x-1)) == 0;