algorithmica icon indicating copy to clipboard operation
algorithmica copied to clipboard

Assembly: Alternative Approach

Open brubrz opened this issue 2 years ago • 1 comments

    mov  rax, -100  ; replace 100 with the array size
loop:
    add  edx, DWORD PTR [rax + 100 + rcx]
    add  rax, 4
    jnz  loop       ; checks if the result is zero

https://github.com/algorithmica-org/algorithmica/blob/master/content/english/hpc/architecture/loops.md

I don't understand why the +rcx is needed? Isn't it enough to add back the 100?

brubrz avatar Feb 07 '23 10:02 brubrz