~drizzle-trunk/drizzle/development

1 by brian
clean slate
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
18
	.file	"strstr-sparc.s"
19
.section	".text"
20
	.align 4
21
	.global strstr
22
	.type	 strstr,#function
23
	.proc	0102
24
strstr:
25
26
!char *strstr(register const char *str,const char *search)
27
!{
28
! register char *i,*j;
29
!skipp:
30
!  while (*str != '\0') {
31
!    if (*str++ == *search) {
32
!      i=(char*) str; j=(char*) search+1;
33
34
	ldsb	[%o1],%o2		! o2= First char of search
35
.top:
36
	ldsb	[%o0],%o4		! o4= First char of rest of str
37
	cmp	%o4,0
38
	be	.abort			! Found end null		; 
39
	cmp	%o4,%o2
40
	bne	.top
41
	add	%o0,1,%o0
42
43
.outloop1:
44
45
!      while (*j)
46
!	if (*i++ != *j++) goto skipp;
47
48
	or	%g0,%o0,%o3
49
	add	%o1,1,%o4		! o4= search+1
50
	ldsb	[%o0],%o5		! o5= [current_str+1]
51
52
.loop2:
53
	ldsb	[%o4],%g4
54
	add	%o4,1,%o4
55
	cmp	%g4,0
56
	be	.end	
57
	cmp	%o5,%g4
58
	bne	.top
59
	add	%o3,1,%o3
60
	ba	.loop2
61
	ldsb	[%o3],%o5
62
63
.end:
64
	retl
65
	sub	%o0,1,%o0
66
.abort:	
67
	retl
68
	or	%g0,0,%o0
69
70
.strstr_end:
71
	.size	 strstr,.strstr_end-strstr
72
	.ident	"Matt Wagner & Monty"