summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-03-25 21:19:51 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-03-25 21:19:51 +0000
commit643236347692ac7464f744020dea1c020c863110 (patch)
treef2b2833ab3ace443559af383f4cb606153847037
parent9cfcc2b9aeed232837a9e3adf3c9a172f054a68b (diff)
downloadrockbox-643236347692ac7464f744020dea1c020c863110.tar.gz
rockbox-643236347692ac7464f744020dea1c020c863110.zip
Fix MIPS FFS implementation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20536 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/mips/ffs-mips.S17
1 files changed, 10 insertions, 7 deletions
diff --git a/firmware/target/mips/ffs-mips.S b/firmware/target/mips/ffs-mips.S
index f1547778d4..92f4e31729 100644
--- a/firmware/target/mips/ffs-mips.S
+++ b/firmware/target/mips/ffs-mips.S
@@ -40,11 +40,14 @@
40 .type find_first_set_bit, %function 40 .type find_first_set_bit, %function
41 41
42find_first_set_bit: 42find_first_set_bit:
43 negu t0, a0 # t0 = a0 & -a0 43 beqz a0, 0 # if(a0 == 0) goto 1
44 and t0, t0, a0 # 44 li v0, 32 # v0 = 32
45 45 negu t0, a0 # t0 = -a0
46 clz v0, t0 # Get lead 0's count 46 and t0, t0, a0 # t0 = a0 & t0
47 clz v0, t0 # Get lead 0's count (v0=32 if all 0's)
47 li t0, 31 # t0 = 31 48 li t0, 31 # t0 = 31
48 sub v0, t0, v0 # Return value = t0 - v0 49 jr ra #
49 jr ra 50 sub v0, t0, v0 # v0 = t0 - v0
50 nop 511:
52 jr ra #
53 nop #