diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-11-25 03:37:45 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-11-25 03:37:45 +0100 |
| commit | 9af248e8a78f111a39d507f199d56eb8af6e52d6 (patch) | |
| tree | 4b86561a5fea5f22d8d51c5b2a029cad98feaa25 /ft_strcmp.s | |
| parent | c0bcb694bbcef0273d6e6fa93854ce6a10432b87 (diff) | |
| download | libasm-9af248e8a78f111a39d507f199d56eb8af6e52d6.tar.gz libasm-9af248e8a78f111a39d507f199d56eb8af6e52d6.tar.bz2 libasm-9af248e8a78f111a39d507f199d56eb8af6e52d6.zip | |
ft_atoi_base.s kinda done
Diffstat (limited to 'ft_strcmp.s')
| -rw-r--r-- | ft_strcmp.s | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/ft_strcmp.s b/ft_strcmp.s index 5be82a5..7704aa5 100644 --- a/ft_strcmp.s +++ b/ft_strcmp.s @@ -17,28 +17,28 @@ _ft_strcmp: push r12 push r13 push rcx - mov r12, rdi ; s1 - mov r13, rsi ; s2 - mov rcx, -1 ; index - FT_STRCMP_LOOP: - inc rcx - cmp byte [r12 + rcx], 0 ; check and of s1 - je FT_STRCMP_LOOP_END - mov dl, byte [r12 + rcx] - cmp dl, byte [r13 + rcx] ; s1[rcx] == s2[rcx] - je FT_STRCMP_LOOP - FT_STRCMP_LOOP_END: + mov r12, rdi ; s1 + mov r13, rsi ; s2 + mov rcx, -1 ; index +FT_STRCMP_LOOP: + inc rcx + cmp byte [r12 + rcx], 0 ; check and of s1 + je FT_STRCMP_LOOP_END + mov dl, byte [r12 + rcx] + cmp dl, byte [r13 + rcx] ; s1[rcx] == s2[rcx] + je FT_STRCMP_LOOP +FT_STRCMP_LOOP_END: - xor rax, rax - mov al, byte [r12 + rcx] - sub al, byte [r13 + rcx] - jnc FT_STRCMP_END ; jump end if no substraction overflow + xor rax, rax + mov al, byte [r12 + rcx] + sub al, byte [r13 + rcx] + jnc FT_STRCMP_END ; jump end if no substraction overflow - neg al ; negate al to cancel overflow - neg eax ; negate the whole int since the function returns that type + neg al ; negate al to cancel overflow + neg eax ; negate the whole int since the function returns that type - FT_STRCMP_END: - pop rcx - pop r13 - pop r12 +FT_STRCMP_END: + pop rcx + pop r13 + pop r12 ret |
