patching here until upstream reacts
static u32 count_leading_bits(s32 data)
{
- u32 cnt = 33;
-
-#ifdef __has_builtin
-#if __has_builtin(__builtin_clrsb)
+#if defined(__has_builtin) && __has_builtin(__builtin_clrsb)
return 1 + __builtin_clrsb(data);
+#else
+ data ^= data >> 31;
+ return data ? clz32(data) : 32;
#endif
-#endif
-
- data = (data ^ (data >> 31)) << 1;
-
- do {
- cnt -= 1;
- data >>= 1;
- } while (data);
-
- return cnt;
}
static void lightrec_mtc2(struct lightrec_state *state, u8 reg, u32 data)