From 9140e0a9cedbb13670716e8d45685c120c054fb4 Mon Sep 17 00:00:00 2001 From: Andreas Kapp Lindquist Date: Tue, 30 Sep 2025 10:09:15 +0200 Subject: fix(insertionsort.s): Save array size across recursive call --- src/insertionsort.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/insertionsort.s') 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 -- cgit v1.2.3-70-g09d2