diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/insertionsort.s | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/insertionsort.s b/src/insertionsort.s index 66f0323..790f620 100644 --- a/src/insertionsort.s +++ b/src/insertionsort.s @@ -30,25 +30,25 @@ insertion_sort: pop %rsi # Restore array size movq (%rdi, %rsi, 8), %rbp # Save address at A[n] in rbp - movq (%rbp, %rdx), %rbx # Save value of A[n] in rbx + movq (%rbp, %rdx, 8), %rbx # Save value of A[n] in rbx movq %rsi, %r15 # Save copy of n in r15 subq $1, %r15 # Make r15 = n-1 = j while: cmp $0, %r15 # Compare j with 0 - jl end # Go to end if less than + jl end_while # Go to end if less than movq (%rdi, %r15, 8), %rbp # Save address at A[j] to rbp - movq (%rbp, %rdx), %r12 # Move value at A[j] into r12 + movq (%rbp, %rdx, 8), %r12 # Move value at A[j] into r12 cmp %r12, %rbx # Compare A[j] with A[n] - jge end # Go to end if greater than or equal + jge end_while # Go to end if greater than or equal movq %r15, %r14 # Duplicate r15 into r14 addq $1, %r14 # And add 1: j+1 movq (%rdi, %r14, 8), %rbp # Save address of A[j+1] in rbp - movq %r12, (%rbp, %rdx) # Move value at A[j] into value at A[j+1] + movq %r12, (%rbp, %rdx, 8) # Move value at A[j] into value at A[j+1] subq $1, %r15 # j = j - 1 |