diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-11 15:44:44 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-11 15:44:44 +0100 |
| commit | d6240e3f6aeb342aaf13284c7cc93226970648aa (patch) | |
| tree | a5fef5bd1d55e0dd63cb986a445254cf8caa94ce /ft_strcmp.s | |
| parent | cd5c9e6a923878e797212d27476ee217eb844a14 (diff) | |
| download | libasm-d6240e3f6aeb342aaf13284c7cc93226970648aa.tar.gz libasm-d6240e3f6aeb342aaf13284c7cc93226970648aa.tar.bz2 libasm-d6240e3f6aeb342aaf13284c7cc93226970648aa.zip | |
Replaced tab with spaces
Diffstat (limited to 'ft_strcmp.s')
| -rw-r--r-- | ft_strcmp.s | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/ft_strcmp.s b/ft_strcmp.s index 7c55a43..bdab204 100644 --- a/ft_strcmp.s +++ b/ft_strcmp.s @@ -22,31 +22,31 @@ global M_FT_STRCMP section .text ; int ft_strcmp(const char *s1, const char *s2); M_FT_STRCMP: - push r12 - push r13 - push rcx - mov r12, rdi ; s1 - mov r13, rsi ; s2 - mov rcx, -1 ; index + 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 + 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 - ret + pop rcx + pop r13 + pop r12 + ret |
