summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/asm/ffs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/firmware/asm/ffs.c b/firmware/asm/ffs.c
index 6826f42e94..a4512e0c55 100644
--- a/firmware/asm/ffs.c
+++ b/firmware/asm/ffs.c
@@ -35,7 +35,8 @@ int find_first_set_bit(uint32_t val)
if (val == 0)
return 32;
- /* __builtin_ffs(l(l)): Returns one plus the index of the least significant
- 1-bit of x, or if x is zero, returns zero. */
- return __builtin_ffs(val) - 1;
+ /* __builtin_ctz[l[l]]: Returns the number of trailing 0-bits in x,
+ * starting at the least significant bit position. If x is 0, the result
+ * is undefined. */
+ return __builtin_ctz(val);
}