From 52cb340962505792bf9df1ee49bc400461624cd5 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Wed, 25 Mar 2009 22:29:49 +0000 Subject: Really fix it git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20538 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/mips/ffs-mips.S | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/firmware/target/mips/ffs-mips.S b/firmware/target/mips/ffs-mips.S index 92f4e31729..fd937a4cae 100644 --- a/firmware/target/mips/ffs-mips.S +++ b/firmware/target/mips/ffs-mips.S @@ -40,14 +40,15 @@ .type find_first_set_bit, %function find_first_set_bit: - beqz a0, 0 # if(a0 == 0) goto 1 - li v0, 32 # v0 = 32 + beqz a0, l # if(a0 == 0) goto l negu t0, a0 # t0 = -a0 - and t0, t0, a0 # t0 = a0 & t0 - clz v0, t0 # Get lead 0's count (v0=32 if all 0's) + and t0, a0, t0 # t0 = a0 & t0 + clz v0, a0 # Get lead 0's count (v0=32 if all 0's) li t0, 31 # t0 = 31 + subu v0, t0, v0 # v0 = t0 - v0 jr ra # - sub v0, t0, v0 # v0 = t0 - v0 -1: - jr ra # + nop # +l: + li v0, 32 # v0 = 32 (don't put this after jr ra! + jr ra # binutils bug?) nop # -- cgit v1.2.3