summaryrefslogtreecommitdiffstats
path: root/b32e.asm
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-12-04 21:51:39 +0100
committerNao Pross <naopross@thearcway.org>2018-12-04 21:51:39 +0100
commit5b8ba5a949627183c116d8216cfc6f2af0ea4d9b (patch)
tree39a135a1056a53adc0da424a6dfc4566d5d26da1 /b32e.asm
parentAdd rough untested implementation for b32d (diff)
downloadbase32asm-master.tar.gz
base32asm-master.zip
Add perftest, update b32e to use a counter instead of mulHEADmaster
Diffstat (limited to 'b32e.asm')
-rw-r--r--b32e.asm22
1 files changed, 8 insertions, 14 deletions
diff --git a/b32e.asm b/b32e.asm
index 8bab796..1e1b7a9 100644
--- a/b32e.asm
+++ b/b32e.asm
@@ -43,10 +43,12 @@ write_output:
b32e:
; save the number of bits read in cl
mov bl, 8 ; each byte contains 8 bits
- mul bl
+ mul bl ; multiply al by 8
mov cl, al
; set up output counter
xor r11, r11
+ ; set up processed bit counter
+ xor ch, ch
; initialize output buffer with padding
mov rbx, 0x3d3d3d3d3d3d3d3d
mov qword [output_buffer], rbx
@@ -70,21 +72,13 @@ b32e:
mov bl, byte [rbx]
mov byte [output_buffer + r11], bl
- ; increase counter
+ ; increase output counter
inc r11
+ ; increase bit counter
+ add ch, 5
- ; check number of bits converted >= bits read
- mov bl, 5 ; each iteration processed 5 bits
- mov rax, r11
- mul bl
- cmp al, cl
- jge .exit
-
- ; check counter
- ; when the counter reaches 8 it means that 8 characters (40 bits)
- ; have been processed and written
- cmp r11, 8
- jl .loop
+ cmp ch, cl
+ jl .loop
.exit:
ret