hex2str: Perform test r9,r9 only once (instead of for each number in loop .convert)

This commit is contained in:
2025-07-10 00:22:36 +02:00
parent 7d559d61da
commit 467b5b7a0b

View File

@@ -109,6 +109,7 @@ udec2str:
; rcx* Counts length of created string ; rcx* Counts length of created string
; r8* Dividor for div ; r8* Dividor for div
; r9* Store arg rsi (uppercase) ; r9* Store arg rsi (uppercase)
; r11* Amount to add to number (for ASCII conversion, lowercase or uppercase)
hex2str: hex2str:
mov r9, rsi mov r9, rsi
mov rsi, cnvtBuff mov rsi, cnvtBuff
@@ -122,19 +123,20 @@ hex2str:
.notZero: .notZero:
mov rax, rdi mov rax, rdi
xor rcx, rcx xor rcx, rcx
mov r8, 87
test r9, r9
cmovz r11, r8
test r9, r9
jz .convert
mov r11, 55
.convert: .convert:
xor rdx, rdx xor rdx, rdx
mov r8, 16 mov r8, 16
div r8 div r8
cmp rdx, 10 cmp rdx, 10
jb .num jb .num
test r9, r9 add rdx, r11
jz .lower
;.upper:
add rdx, 55
jmp .push
.lower:
add rdx, 87
jmp .push jmp .push
.num: .num:
add rdx, '0' add rdx, '0'