1
; Copyright (C) 2000 MySQL AB
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
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.
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,
18
TITLE Optimized cmp of pointer to strings of unsigned chars
28
PUBLIC _get_ptr_compare
33
mov dx,seg strings:_ptr_cmp
34
mov ax,offset _ptr_cmp_0
36
mov ax,offset _ptr_cmp_1
39
mov ax,offset _ptr_cmp
44
mov AX,0 ; Emptyt strings are always equal
51
mov dx,si ; Save si and ds
53
lds si,DWORD PTR ss:[bx+4] ; s1
54
lds si,DWORD PTR ds:[si]
57
lds si,DWORD PTR ss:[bx+8] ; s2
58
lds si,DWORD PTR ds:[si]
62
mov ds,cx ; restore si and ds
73
mov cx,compare_length ; Length of memory-area
74
lds si,DWORD PTR [bp+4] ; s1
75
lds si,DWORD PTR ds:[si]
76
les di,DWORD PTR [bp+8] ; s2
77
les di,DWORD PTR es:[di]
80
repe cmpsb ; Compare strings
81
je @F ; Strings are equal
97
fix_es MACRO fix_cld ; Load ES if neaded
108
compare_length dd 0 ; Length of strings
111
begcode get_ptr_compare
112
public _get_ptr_compare
113
_get_ptr_compare proc near
114
mov ecx,P-SIZEPTR[esp]
115
mov compare_length,ecx
116
mov eax,offset _TEXT:_ptr_cmp_0
118
mov eax,offset _TEXT:_ptr_cmp_1
121
mov eax,offset _TEXT:_ptr_cmp
123
_get_ptr_compare endp
124
endcode _get_ptr_compare
129
mov EAX,0 ; Emptyt strings are always equal
137
mov edx,esi ; Save esi
138
mov esi,P-SIZEPTR[esp] ; *s1
145
mov esi,edx ; Restore esi
156
mov edx,edi ; Save esi
160
mov edi,P+SIZEPTR[ebp] ; *s2
162
mov ecx,compare_length ; Length of memory-area
164
repe cmpsb ; Compare strings
165
je @F ; Strings are equal