strlen.inc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.9 2004-01-12 18:37:10 jonas
  32. * use volatile instead of non-volatile registers
  33. Revision 1.8 2003/11/23 17:34:27 jonas
  34. * fixed some label names
  35. Revision 1.7 2003/11/15 19:01:27 florian
  36. * fixed rtl to work with the integrated fpc ppc assembler reader
  37. Revision 1.6 2003/06/14 12:41:09 jonas
  38. * fixed compilation problems (removed unnecessary modified registers
  39. lists from procedures)
  40. Revision 1.5 2002/09/11 07:49:40 jonas
  41. * fixed assembler errors
  42. Revision 1.4 2002/09/07 16:01:26 peter
  43. * old logs removed and tabs fixed
  44. Revision 1.3 2002/08/18 21:37:48 florian
  45. * several errors in inline assembler fixed
  46. Revision 1.2 2002/08/10 17:14:36 jonas
  47. * various fixes, mostly changing the names of the modifies registers to
  48. upper case since that seems to be required by the compiler
  49. }