]>
Commit | Line | Data |
---|---|---|
e9ce8d39 A |
1 | /* |
2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | .text | |
23 | .globl _strcmp | |
24 | _strcmp: | |
25 | #if defined(__i386__) | |
26 | movl 0x04(%esp),%eax | |
27 | movl 0x08(%esp),%edx | |
28 | jmp L2 /* Jump into the loop! */ | |
29 | ||
30 | .align 2,0x90 | |
31 | L1: incl %eax | |
32 | incl %edx | |
33 | L2: movb (%eax),%cl | |
34 | testb %cl,%cl /* null terminator??? */ | |
35 | jz L3 | |
36 | cmpb %cl,(%edx) /* chars match??? */ | |
37 | jne L3 | |
38 | incl %eax | |
39 | incl %edx | |
40 | movb (%eax),%cl | |
41 | testb %cl,%cl | |
42 | jz L3 | |
43 | cmpb %cl,(%edx) | |
44 | jne L3 | |
45 | incl %eax | |
46 | incl %edx | |
47 | movb (%eax),%cl | |
48 | testb %cl,%cl | |
49 | jz L3 | |
50 | cmpb %cl,(%edx) | |
51 | jne L3 | |
52 | incl %eax | |
53 | incl %edx | |
54 | movb (%eax),%cl | |
55 | testb %cl,%cl | |
56 | jz L3 | |
57 | cmpb %cl,(%edx) | |
58 | jne L3 | |
59 | incl %eax | |
60 | incl %edx | |
61 | movb (%eax),%cl | |
62 | testb %cl,%cl | |
63 | jz L3 | |
64 | cmpb %cl,(%edx) | |
65 | jne L3 | |
66 | incl %eax | |
67 | incl %edx | |
68 | movb (%eax),%cl | |
69 | testb %cl,%cl | |
70 | jz L3 | |
71 | cmpb %cl,(%edx) | |
72 | jne L3 | |
73 | incl %eax | |
74 | incl %edx | |
75 | movb (%eax),%cl | |
76 | testb %cl,%cl | |
77 | jz L3 | |
78 | cmpb %cl,(%edx) | |
79 | jne L3 | |
80 | incl %eax | |
81 | incl %edx | |
82 | movb (%eax),%cl | |
83 | testb %cl,%cl | |
84 | jz L3 | |
85 | cmpb %cl,(%edx) | |
86 | je L1 | |
87 | .align 2, 0x90 | |
88 | L3: movzbl (%eax),%eax /* unsigned comparison */ | |
89 | movzbl (%edx),%edx | |
90 | subl %edx,%eax | |
91 | ret | |
92 | #elif defined(__ppc__) | |
93 | mr r5,r3 | |
94 | 1: lbz r3,0(r5) | |
95 | addi r5,r5,1 | |
96 | cmpwi cr1,r3,0 | |
97 | lbz r0,0(r4) | |
98 | addi r4,r4,1 | |
99 | subf. r3,r0,r3 | |
100 | beqlr+ cr1 | |
101 | beq- 1b | |
102 | blr | |
103 | #else | |
104 | #error strcmp is not defined for this architecture | |
105 | #endif |