Subversion Repositories Kolibri OS

Rev

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

Rev 5394 Rev 5907
Line 53... Line 53...
53
  @@:
53
  @@:
54
    inc     eax
54
    inc     eax
55
    ret
55
    ret
56
 endp
56
 endp
Line -... Line 57...
-
 
57
 
-
 
58
 proc string.cmp uses ecx esi edi, _str1, _str2, _n
-
 
59
    mov     ecx, [_n]
-
 
60
    test    ecx, ecx	     ; Max length is zero?
-
 
61
    je	    .done
-
 
62
 
-
 
63
    mov     esi, [_str1]	; esi = string s1
-
 
64
    mov     edi, [_str2]	; edi = string s2
-
 
65
    cld
-
 
66
 .compare:
-
 
67
    cmpsb		     ; Compare two bytes
-
 
68
    jne     .done
-
 
69
    cmp     byte [esi-1], 0  ; End of string?
-
 
70
    je	    .done
-
 
71
    dec     ecx 	     ; Length limit reached?
-
 
72
    jne     .compare
-
 
73
 .done:
-
 
74
    seta    al		     ; al = (s1 > s2)
-
 
75
    setb    ah		     ; ah = (s1 < s2)
-
 
76
    sub     al, ah
-
 
77
    movsx   eax, al	     ; eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1
-
 
78
    ret
-
 
79
 endp
57
 
80
 
58
 proc string.to_lower_case uses eax, _str
81
 proc string.to_lower_case uses eax, _str
59
    mov     eax, [_str]
82
    mov     eax, [_str]
60
  @@:
83
  @@:
61
    cmp     [eax], byte 0
84
    cmp     [eax], byte 0