*/
uint8_t clz(uint32_t x);
+/* Return the number of the highest '1' bit in a value
+ * Will return 255 when there's no bit set.
+ */
+static inline uint8_t msb(uint32_t x)
+{
+ return (31 - clz(x));
+}
+
/* Count traling zeroes
* The following function is an effitient way to implement __builtin_ctz().
*/
uint8_t ctz(uint32_t x);
+/* Return the number of the lowest '1' bit in a value
+ * Will return 32 when there's no bit set.
+ */
+//static inline uint8_t lsb(uint32_t x) __attribute__ ((alias ("ctz")));
+
/* Count bits set
*/
uint8_t bits_set(uint32_t x);