strlen.inc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Processor specific implementation of strlen
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { in: p in r3 }
  13. { out: result (length) in r3 }
  14. asm
  15. { load the begin of the string in the data cache }
  16. dcbt 0,r3
  17. { empty/invalid string? }
  18. cmplwi cr0,r3,0
  19. { if yes, do nothing }
  20. beq .LStrLenDone
  21. subi r9,r3,1
  22. .LStrLenLoop:
  23. lbzu r10,1(r9)
  24. cmplwi cr0,r10,0
  25. bne .LStrLenLoop
  26. sub r3,r9,r3
  27. .LStrLenDone:
  28. end;
  29. {
  30. $Log$
  31. Revision 1.10 2005-02-14 17:13:31 peter
  32. * truncate log
  33. }