forked from len0rd/rockbox
Coldfire strlen, slight optimization pointed out by amiconn, eliminate some unconditionla branches by rearranging the code handling the head bytes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25968 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a5d8d21596
commit
aa1e471f9a
1 changed files with 2 additions and 9 deletions
|
@ -31,21 +31,14 @@ strlen:
|
|||
move.l %a0, %a1 /* %a1 = start address */
|
||||
move.l %a0, %d0
|
||||
andi.l #3, %d0 /* %d0 = %a0 & 3 */
|
||||
jmp.l (2,%pc,%d0.l*2)
|
||||
bra.b .bytes0
|
||||
bra.b .bytes3
|
||||
bra.b .bytes2
|
||||
bra.b .bytes1
|
||||
.bytes3:
|
||||
beq.b 1f /* already aligned */
|
||||
jmp.l (-2,%pc,%d0.l*4)
|
||||
tst.b (%a0)+
|
||||
beq.b .done
|
||||
.bytes2:
|
||||
tst.b (%a0)+
|
||||
beq.b .done
|
||||
.bytes1:
|
||||
tst.b (%a0)+
|
||||
beq.b .done
|
||||
.bytes0:
|
||||
|
||||
1:
|
||||
move.l (%a0)+, %d0 /* load %d0 increment %a0 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue