From aef72931a3464131f361933b7dc4bc8ff7d692c6 Mon Sep 17 00:00:00 2001 From: Kwarde Date: Sun, 20 Jul 2025 11:47:31 +0200 Subject: [PATCH] atoi(): Don't use extra loop for calculating base^n; r9 already holds previous value so just do r9*rsi ( [previous base^n] * base) --- src/convert.asm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/convert.asm b/src/convert.asm index 0368d6b..4408765 100644 --- a/src/convert.asm +++ b/src/convert.asm @@ -116,14 +116,8 @@ atoi: mov r9, rsi jmp .calcNum .calcBase_otherLoops: - mov rax, rsi - mov r9, r8 - dec r9 - .calcBaseLoop: - imul rsi - dec r9 - test r9, r9 - jnz .calcBaseLoop + mov rax, r9 + imul rsi mov r9, rax ; Calculate number