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:
zombie maniac 2021-09-19 12:20:15 -04:00
parent 67363c7013
commit 015f460d7f

View file

@ -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