removed length code from differ
after galaxy brianing i realize i dont need to check the length of the strings because if it compares a character with another from another string and one is a zero we have reached the end of the string and we arnt reading memory that isnt ours
This commit is contained in:
parent
67363c7013
commit
015f460d7f
1 changed files with 0 additions and 24 deletions
24
diff.asm
24
diff.asm
|
@ -1,9 +1,4 @@
|
||||||
extern puts
|
extern puts
|
||||||
%include "../inc/length_func.inc"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
section .data
|
section .data
|
||||||
text db "REEEEEEEEEE",0
|
text db "REEEEEEEEEE",0
|
||||||
|
@ -19,25 +14,6 @@ main:
|
||||||
sub rsp, 8 ;enter
|
sub rsp, 8 ;enter
|
||||||
|
|
||||||
|
|
||||||
;below we are getting the length of each string
|
|
||||||
;we do this because we dont want to compare with memory that isnt ours
|
|
||||||
|
|
||||||
mov r8, text
|
|
||||||
call length_func
|
|
||||||
mov [textlength], rax
|
|
||||||
|
|
||||||
mov r8, text2
|
|
||||||
call length_func
|
|
||||||
mov [text2length], rax
|
|
||||||
|
|
||||||
mov r8, [textlength]
|
|
||||||
mov r9, [text2length]
|
|
||||||
|
|
||||||
cmp r8, r9
|
|
||||||
jne _differ
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before)
|
xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before)
|
||||||
_loop:
|
_loop:
|
||||||
;loop tings
|
;loop tings
|
||||||
|
|
Loading…
Reference in a new issue