diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2012-02-04 18:08:17 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2012-02-04 18:08:17 -0500 |
commit | 67dd4d6995c2bef9910e031f23aae88e07354587 (patch) | |
tree | 28ea88021d436a9f7447143757c438af52d1f41d /firmware/asm/ffs.c | |
parent | 1a083cdaccb3598de834c3643c5bc02716af804d (diff) | |
download | rockbox-67dd4d6995c2bef9910e031f23aae88e07354587.tar.gz rockbox-67dd4d6995c2bef9910e031f23aae88e07354587.zip |
Generic find_first_set_bit can use __builtin_ctz instead of __builtin_ffsbootloader_clipv2_v5
The former gives 0-based indexes, which is what our implementation returns,
making the "- 1" unnecessary.
Change-Id: I172ab5e06695be62e4a18d4fd0415b8314f5dc26
Diffstat (limited to 'firmware/asm/ffs.c')
-rw-r--r-- | firmware/asm/ffs.c | 7 |
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) | |||
35 | if (val == 0) | 35 | if (val == 0) |
36 | return 32; | 36 | return 32; |
37 | 37 | ||
38 | /* __builtin_ffs(l(l)): Returns one plus the index of the least significant | 38 | /* __builtin_ctz[l[l]]: Returns the number of trailing 0-bits in x, |
39 | 1-bit of x, or if x is zero, returns zero. */ | 39 | * starting at the least significant bit position. If x is 0, the result |
40 | return __builtin_ffs(val) - 1; | 40 | * is undefined. */ |
41 | return __builtin_ctz(val); | ||
41 | } | 42 | } |