]> git.saurik.com Git - apple/libc.git/blame - i386/string/strcmp.s
Libc-262.2.12.tar.gz
[apple/libc.git] / i386 / string / strcmp.s
CommitLineData
e9ce8d39
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
734aad71 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
e9ce8d39 7 *
734aad71
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
e9ce8d39
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
734aad71
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
e9ce8d39
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25.text
26.globl _strcmp
27_strcmp:
e9ce8d39
A
28 movl 0x04(%esp),%eax
29 movl 0x08(%esp),%edx
30 jmp L2 /* Jump into the loop! */
31
32 .align 2,0x90
33L1: incl %eax
34 incl %edx
35L2: movb (%eax),%cl
36 testb %cl,%cl /* null terminator??? */
37 jz L3
38 cmpb %cl,(%edx) /* chars match??? */
39 jne L3
40 incl %eax
41 incl %edx
42 movb (%eax),%cl
43 testb %cl,%cl
44 jz L3
45 cmpb %cl,(%edx)
46 jne L3
47 incl %eax
48 incl %edx
49 movb (%eax),%cl
50 testb %cl,%cl
51 jz L3
52 cmpb %cl,(%edx)
53 jne L3
54 incl %eax
55 incl %edx
56 movb (%eax),%cl
57 testb %cl,%cl
58 jz L3
59 cmpb %cl,(%edx)
60 jne L3
61 incl %eax
62 incl %edx
63 movb (%eax),%cl
64 testb %cl,%cl
65 jz L3
66 cmpb %cl,(%edx)
67 jne L3
68 incl %eax
69 incl %edx
70 movb (%eax),%cl
71 testb %cl,%cl
72 jz L3
73 cmpb %cl,(%edx)
74 jne L3
75 incl %eax
76 incl %edx
77 movb (%eax),%cl
78 testb %cl,%cl
79 jz L3
80 cmpb %cl,(%edx)
81 jne L3
82 incl %eax
83 incl %edx
84 movb (%eax),%cl
85 testb %cl,%cl
86 jz L3
87 cmpb %cl,(%edx)
88 je L1
89 .align 2, 0x90
90L3: movzbl (%eax),%eax /* unsigned comparison */
91 movzbl (%edx),%edx
92 subl %edx,%eax
93 ret