aboutsummaryrefslogtreecommitdiff
path: root/src/insertionsort.s
diff options
context:
space:
mode:
authorAndreas Kapp Lindquist <alind24@student.sdu.dk>2025-09-30 10:09:15 +0200
committermithe24 <mithe24@student.sdu.dk>2025-10-29 13:49:57 +0100
commit9140e0a9cedbb13670716e8d45685c120c054fb4 (patch)
tree70908392afe712afe2ddcea06a521b915325f66a /src/insertionsort.s
parent4723e8601f881f2a3d00c77fe2f5fac0366db8ae (diff)
downloadsorter-9140e0a9cedbb13670716e8d45685c120c054fb4.tar.gz
sorter-9140e0a9cedbb13670716e8d45685c120c054fb4.zip
fix(insertionsort.s): Save array size across recursive call
Diffstat (limited to '')
-rw-r--r--src/insertionsort.s4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/insertionsort.s b/src/insertionsort.s
index 9fd158e..490d56b 100644
--- a/src/insertionsort.s
+++ b/src/insertionsort.s
@@ -25,10 +25,10 @@ insertion_sort:
cmp $0, %rsi # Check if length of array is zero
je end # Jump to end if it is
- push %rsi # Save array size
subq $1, %rsi # Decrease size of array
+ push %rsi
call insertion_sort # Sort recursively
- pop %rsi # Restore array size
+ pop %rsi
movq (%rdi, %rsi, 8), %rbp # Save address at A[n] in rbp
movq (%rbp, %rdx, 8), %rbx # Save value of A[n] in rbx