Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
; strlen function
2
;
3
; Copyright (c) 2003 Thomas Mathys
4
; killer@vantage.ch
5
;
6
; This program is free software; you can redistribute it and/or modify
7
; it under the terms of the GNU General Public License as published by
8
; the Free Software Foundation; either version 2 of the License, or
9
; (at your option) any later version.
10
;
11
; This program is distributed in the hope that it will be useful,
12
; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
; GNU General Public License for more details.
15
;
16
; You should have received a copy of the GNU General Public License
17
; along with this program; if not, write to the Free Software
18
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
;
20
%ifndef _STRLEN_INC
21
%define _STRLEN_INC
22
 
23
 
24
;********************************************************************
25
;	returns the length of an asciiz string
26
;	input		:	esi = pointer to string
27
;	output		:	eax = string length
28
;	destroys	:	nothing
29
;********************************************************************
30
strlen:
31
	push	ecx
32
	push	edi
33
	pushfd
34
	cld				; !
35
	mov	ecx,-1
36
	mov	edi,esi			; find terminating zero
37
	xor	al,al
38
	repne	scasb
39
	mov	eax,edi			; calculate string length
40
	sub	eax,esi
41
	dec	eax
42
	popfd
43
	pop	edi
44
	pop	ecx
45
	ret
46
 
47
 
48
%endif
49