]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/bitops.h
Mainloop: Be benevolent when file_del() is called on a closed fd
[libucw.git] / ucw / bitops.h
index 9e5e5df8b2be75761bcf70cd7e425860d6f62f52..0991de34f1dfe0756d3dbf49c0c804bbdc541229 100644 (file)
 #ifndef _UCW_BITOPS_H
 #define _UCW_BITOPS_H
 
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define bit_fls ucw_bit_fls
+#define ffs_table ucw_ffs_table
+#endif
+
 /* Find highest bit set (i.e., the floor of the binary logarithm) (bit-fls.c) */
 
 int bit_fls(u32 x);            /* bit_fls(0)=-1 */
@@ -21,7 +26,7 @@ extern const byte ffs_table[256];
 
 #ifdef __pentium4              /* On other ia32 machines, the C version is faster */
 
-static inline uns bit_ffs(uns w)
+static inline uint bit_ffs(uint w)
 {
   asm("bsfl %1,%0" :"=r" (w) :"rm" (w));
   return w;
@@ -29,9 +34,9 @@ static inline uns bit_ffs(uns w)
 
 #else
 
-static inline uns bit_ffs(uns w)
+static inline uint bit_ffs(uint w)
 {
-  uns b = (w & 0xffff) ? 0 : 16;
+  uint b = (w & 0xffff) ? 0 : 16;
   b += ((w >> b) & 0xff) ? 0 : 8;
   return b + ffs_table[(w >> b) & 0xff];
 }
@@ -42,16 +47,16 @@ static inline uns bit_ffs(uns w)
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
 
-static inline uns bit_count(uns w)
+static inline uint bit_count(uint w)
 {
   return __builtin_popcount(w);
 }
 
 #else
 
-static inline uns bit_count(uns w)
+static inline uint bit_count(uint w)
 {
-  uns n = 0;
+  uint n = 0;
   while (w)
     {
       w &= w - 1;