You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
26 years ago
  1. ! Copyright (C) 2000, 2002 MySQL AB
  2. !
  3. ! This library is free software; you can redistribute it and/or
  4. ! modify it under the terms of the GNU Library General Public
  5. ! License as published by the Free Software Foundation; version 2
  6. ! of the License.
  7. !
  8. ! This library 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. See the GNU
  11. ! Library General Public License for more details.
  12. !
  13. ! You should have received a copy of the GNU Library General Public
  14. ! License along with this library; if not, write to the Free
  15. ! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  16. ! MA 02111-1307, USA
  17. .file "strstr-sparc.s"
  18. .section ".text"
  19. .align 4
  20. .global strstr
  21. .type strstr,#function
  22. .proc 0102
  23. strstr:
  24. !char *strstr(register const char *str,const char *search)
  25. !{
  26. ! register char *i,*j;
  27. !skipp:
  28. ! while (*str != '\0') {
  29. ! if (*str++ == *search) {
  30. ! i=(char*) str; j=(char*) search+1;
  31. ldsb [%o1],%o2 ! o2= First char of search
  32. .top:
  33. ldsb [%o0],%o4 ! o4= First char of rest of str
  34. cmp %o4,0
  35. be .abort ! Found end null ;
  36. cmp %o4,%o2
  37. bne .top
  38. add %o0,1,%o0
  39. .outloop1:
  40. ! while (*j)
  41. ! if (*i++ != *j++) goto skipp;
  42. or %g0,%o0,%o3
  43. add %o1,1,%o4 ! o4= search+1
  44. ldsb [%o0],%o5 ! o5= [current_str+1]
  45. .loop2:
  46. ldsb [%o4],%g4
  47. add %o4,1,%o4
  48. cmp %g4,0
  49. be .end
  50. cmp %o5,%g4
  51. bne .top
  52. add %o3,1,%o3
  53. ba .loop2
  54. ldsb [%o3],%o5
  55. .end:
  56. retl
  57. sub %o0,1,%o0
  58. .abort:
  59. retl
  60. or %g0,0,%o0
  61. .strstr_end:
  62. .size strstr,.strstr_end-strstr
  63. .ident "Matt Wagner & Monty"