fpc/rtl/powerpc/strlen.inc
peter 4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00

34 lines
971 B
PHP

{
This file is part of the Free Pascal run time library.
Copyright (c) 1999-2000 by the Free Pascal development team
Processor specific implementation of strlen
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{ in: p in r3 }
{ out: result (length) in r3 }
asm
{ load the begin of the string in the data cache }
dcbt 0,r3
{ empty/invalid string? }
cmplwi cr0,r3,0
{ if yes, do nothing }
beq .LStrLenDone
subi r9,r3,1
.LStrLenLoop:
lbzu r10,1(r9)
cmplwi cr0,r10,0
bne .LStrLenLoop
sub r3,r9,r3
.LStrLenDone:
end;