Subversion Repositories Kolibri OS

Rev

Rev 1338 | Rev 3244 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1338 Rev 1467
Line 26... Line 26...
26
;       input           :       esi = pointer to string
26
;       input           :       esi = pointer to string
27
;       output          :       eax = string length
27
;       output          :       eax = string length
28
;       destroys        :       nothing
28
;       destroys        :       nothing
29
;********************************************************************
29
;********************************************************************
30
strlen:
30
strlen:
31
	push	ecx
-
 
32
	push	edi
31
	push	ecx edi
33
	pushfd
32
	pushfd
34
	cld				; !
33
	cld				; !
35
	mov	ecx,-1
34
	mov	ecx,-1
36
	mov	edi,esi 		; find terminating zero
35
	mov	edi,esi 		; find terminating zero
37
	xor	al,al
36
	xor	al,al
38
	repne	scasb
37
	repne	scasb
39
	mov	eax,edi 		; calculate string length
38
	mov	eax,edi 		; calculate string length
40
	sub	eax,esi
39
	sub	eax,esi
41
	dec	eax
40
	dec	eax
42
	popfd
41
	popfd
43
	pop	edi
-
 
44
	pop	ecx
42
	pop	edi ecx
45
	ret
43
	ret
Line 46... Line 44...
46
 
44
 
47
 
45
 
48
 
46
 
Line 49... Line 47...
49
; linlen function
47
; linlen function
50
;
-
 
51
; Copyright (c) 2009 Igor Afanasiev
48
;
52
 
49
; Copyright (c) 2009 Igor Afanasiev
53
linlen:
50
 
54
	push	ecx
51
linlen:
55
	push	edi
52
	push	ecx edi
56
	pushfd
53
	pushfd
Line 62... Line 59...
62
	repne	scasb
59
	repne	scasb
63
	mov	eax,edi 		; calculate string length
60
	mov	eax,edi 		; calculate string length
64
	sub	eax,esi
61
	sub	eax,esi
65
	dec	eax
62
	dec	eax
66
	popfd
63
	popfd
67
	pop	edi
-
 
68
	pop	ecx
64
	pop	edi ecx
69
	ret
65
	ret
70
;%endif
66
;%endif