]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - lib/bitops.h
Fletcher16 test fixed to work at bigendian architectures.
[thirdparty/bird.git] / lib / bitops.h
index af648c268e1e8fc9d9daeb63145985188af39d78..a4c48a10f6c4ec8b5d128249615c6af715797e6b 100644 (file)
@@ -29,4 +29,9 @@ static inline u32 u32_hash(u32 v) { return v * 2902958171u; }
 
 static inline u8 u32_popcount(u32 v) { return __builtin_popcount(v); }
 
+static inline int u32_clz(u32 v) { return __builtin_clz(v); }
+static inline int u32_ctz(u32 v) { return __builtin_ctz(v); }
+
+static inline int uint_is_pow2(uint n) { return n && !(n & (n-1)); }
+
 #endif