-#ifndef ROS_KERN_BITOPS_H
-#define ROS_KERN_BITOPS_H
+#pragma once
#define BIT(nr) (1UL << (nr))
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
//return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
}
+static inline unsigned fls_long(unsigned long l)
+{
+ if (sizeof(l) == 4)
+ return fls(l);
+ return fls64(l);
+}
+
// not used yet and I have other things I'm trying to do
#if 0
static inline bool BITMASK_IS_SET_IN_RANGE(uint8_t* m, size_t beg, size_t end)
/* Runs *work on every bit in the bitmask, passing *work the value of the bit
- * that is set. Optionally clears the bit from the bitmask.
+ * that is set. Optionally clears the bit from the bitmask.
*
* We need this to be a macro, so that the calling code doesn't need the
* address for work_fn. This matters for code that has nested functions that
if (present) \
(work_fn)(i); \
} \
-}
+}
#endif
-#endif /* ROS_KERN_BITOPS_H */