summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-02-05 21:36:11 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-02-05 21:36:11 +0000
commite1aee318782d89e017e1241847706b21ea014974 (patch)
tree3ac116f5d3b44e68a33df10ec0f1a71bdd9f9ccf
parente3927102ba1d68b4b7cc37511df85238a62e8f0e (diff)
downloadrockbox-e1aee318782d89e017e1241847706b21ea014974.tar.gz
rockbox-e1aee318782d89e017e1241847706b21ea014974.zip
Fix MIPS ffs implementation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19930 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/mips/ffs-mips.S12
1 files changed, 4 insertions, 8 deletions
diff --git a/firmware/target/mips/ffs-mips.S b/firmware/target/mips/ffs-mips.S
index 4f798720a5..f1547778d4 100644
--- a/firmware/target/mips/ffs-mips.S
+++ b/firmware/target/mips/ffs-mips.S
@@ -40,15 +40,11 @@
.type find_first_set_bit, %function
find_first_set_bit:
- beqz a0, no_bits_set # If val == 0 branch to no_bits_set
+ negu t0, a0 # t0 = a0 & -a0
+ and t0, t0, a0 #
- clz v0, a0 # Get lead 0's count
+ clz v0, t0 # Get lead 0's count
li t0, 31 # t0 = 31
sub v0, t0, v0 # Return value = t0 - v0
- jr ra # Return
- nop
-
-no_bits_set:
- li v0, 32 # Return value = 32
- jr ra # Return
+ jr ra
nop