VirtualBox

source: vbox/trunk/src/VBox/Runtime/string/strcmp.asm@ 3261

Last change on this file since 3261 was 2988, checked in by vboxsync, 17 years ago

InnoTek -> innotek part 4: more miscellaneous files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1; $Id: strcmp.asm 2988 2007-06-01 17:36:09Z vboxsync $
2;; @file
3; innotek Portable Runtime - No-CRT strcmp - AMD64 & X86.
4;
5
6;
7; Copyright (C) 2006-2007 innotek GmbH
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License as published by the Free Software Foundation,
13; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14; distribution. VirtualBox OSE is distributed in the hope that it will
15; be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; If you received this file as part of a commercial VirtualBox
18; distribution, then only the terms of your commercial VirtualBox
19; license agreement apply instead of the previous paragraph.
20;
21
22%include "iprt/asmdefs.mac"
23
24BEGINCODE
25
26;;
27; @param psz1 gcc: rdi msc: rcx x86:[esp+4]
28; @param psz2 gcc: rsi msc: rdx x86:[esp+8]
29BEGINPROC RT_NOCRT(strcmp)
30 ; input
31%ifdef __AMD64__
32 %ifdef ASM_CALL64_MSC
33 %define psz1 rcx
34 %define psz2 rdx
35 %else
36 %define psz1 rdi
37 %define psz2 rsi
38 %endif
39%else
40 mov ecx, [esp + 4]
41 mov edx, [esp + 8]
42 %define psz1 ecx
43 %define psz2 edx
44%endif
45
46 ;
47 ; The loop.
48 ;
49.next:
50 mov al, [psz1]
51 mov ah, [psz2]
52 cmp al, ah
53 jne .not_equal
54 test al, al
55 jz .equal
56
57 mov al, [psz1 + 1]
58 mov ah, [psz2 + 1]
59 cmp al, ah
60 jne .not_equal
61 test al, al
62 jz .equal
63 inc psz1
64 inc psz2
65
66 mov al, [psz1 + 2]
67 mov ah, [psz2 + 2]
68 cmp al, ah
69 jne .not_equal
70 test al, al
71 jz .equal
72 inc psz1
73 inc psz2
74
75 mov al, [psz1 + 3]
76 mov ah, [psz2 + 3]
77 cmp al, ah
78 jne .not_equal
79 test al, al
80 jz .equal
81
82 add psz1, 4
83 add psz2, 4
84 jmp .next
85
86.equal:
87 xor eax, eax
88 ret
89
90.not_equal:
91 movzx ecx, ah
92 and eax, 0ffh
93 sub eax, ecx
94 ret
95ENDPROC RT_NOCRT(strcmp)
96
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette