In my work, most of apps are quite big and carring a lot of
"big" task, converting,formating, linking ... ect big amounts of data.
So speed of a proc carring one of those tasks is more critical then size of them.
For several cases I developed some table base and index mode branching algorithms wich are more faster than "classic" style ones.
I didn't offer them before 'cause:
1. I didn't see projects of programmers here that need the same intensive processing of data.
2. M32lib mostly contains very short procedures.
3. Some of them is int. property of the firm though I did them.
I belive that the only proc based on table + index convertion was
very simple binaryascii code I submit few months ago.

Now I can submit one other of the procs, wich do the same as
dwtoa. But lot faster from - 20 to 60 clocks depending on value to convert.
It use 4000 bytes table and altogether with code section ~ 4123 bytes.

I don't belive that faster algo was invented yet. Though it's quite possible that some programmer can improve speed or size in a little bit different implementation of the algo.

I wouldn't recommend it to use the proc when you need convert
couple numbers, but in lengthy tasks it can be of much help.

So are you interested?
Posted on 2001-09-18 05:10:29 by The Svin
Sure, it's always interesting to see what people can come up with :)
Posted on 2001-09-18 06:26:48 by f0dder
yup, would be nice :)
Posted on 2001-09-18 07:06:26 by bazik
How else am I going to get educated? :)
Posted on 2001-09-18 08:06:51 by bitRAKE
Welcome back to the "Basics of Asm32."

& don't make me beg ;)
Posted on 2001-09-18 10:26:48 by rafe
First I give a proc with the algo.
Next we need to decide about format for m23lib
I'll expalain why there is a question about format later.



.586
.model flat,stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\kernel32.inc
includelib kernel32.lib
includelib user32.lib
.data?
buffer db 12 dup (?)
.code
start: mov eax,1234567890
mov edi,offset buffer
call DwordDec2Asc
invoke MessageBox,0,offset buffer,0,0

.data
align 8
dig1 = '0'
dig2 = '0'
dig3 = '0'
len = 1
tblXDec2Asc equ $
REPT 1000
dd len shl 24 + dig3 shl 16 + dig2 shl 8 + dig1
if len eq 1
dig1=dig1+1
if dig1 gt '9'
len=2
dig1='1'
endif
elseif len eq 2
dig2=dig2+1
if dig2 gt '9'
dig2='0'
dig1=dig1+1
if dig1 gt '9'
len=3
dig1='1'
endif
endif
elseif len eq 3
dig3=dig3+1
if dig3 gt '9'
dig3='0'
dig2=dig2+1
if dig2 gt '9'
dig2='0'
dig1=dig1+1
endif
endif
endif
ENDM
.code
; edi-buffer for string
; eax-number
DwordDec2Asc proc
mov ebx,esp
@@lpG: mov ecx,eax
mov edx,10624DD3h
mul edx
shr edx,6
imul eax,edx,1000
sub ecx,eax
mov eax,edx
push [tblXDec2Asc+4*ecx]
or eax,eax
jne @@lpG
sub ebx,esp
pop eax
mov ecx,eax
mov [edi],eax
shr ecx,24
jmp [tbl-4+ebx]
.data
align 4
tbl dd @@0,@@1,@@2,@@3
.code
@@3: pop dword ptr [edi+ecx]
add ecx,3
@@2: pop dword ptr [edi+ecx]
add ecx,3
@@1: pop dword ptr [edi+ecx]
add ecx,3
@@0: add edi,ecx
mov byte ptr [edi],0
ret
DwordDec2Asc endp
end start
Posted on 2001-09-22 11:24:59 by The Svin