So long,
New proc performs subj.
There is no such a proc in M32lib so, I hope, Steve can find it
worthy to include this one in it.
I post it inside testing apps so you can try at least realiability.
Chagne testing numbers from zero to highest possible 64 bit
numbers to check the results.
If you need comments or an explonation of the algo - just let me know.
Here it is:


.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

uqw2a PROTO :DWORD,:DWORD

.data
bignum dq 18445678901234567890
.data?
bcdnum real10 ?
bcdstring db 24 dup (?)
.code
start:
invoke uqw2a,offset bcdstring,offset bignum

invoke MessageBox,0,offset bcdstring,0,0
call ExitProcess
;The Svin (c)
uqw2a proc uses ebx esi edi lBuffer,lQword

LOCAL num18:QWORD
mov esi,lQword
mov edx,[esi]
mov eax,[esi+4]
mov edi,lBuffer
N19H equ 0DE0B6B3h
N19L equ 0A7640000h
N20H equ 8AC72304h
N20L equ 89E80000h
cmp eax,N19H
jc C18
jne C20
cmp edx,N19L
jc C18
C20: cmp eax,N20H
jc DO19
jne DO20
cmp edx,N20L
jc DO19
DO20: mov byte ptr [edi],'1'
sub edx,N20L
lea edi,[edi+1]
sbb eax,N20H
DO19: mov byte ptr [edi],'0'-1
@@: inc byte ptr [edi]
sub edx,N19L
sbb eax,N19H
jnc @B
add edx,N19L
adc eax,N19H
inc edi
C18: mov dword ptr num18,edx
mov dword ptr num18+4,eax

sub esp,10
fild num18
fbstp [esp]
xor esi,esi
@@:
pop eax
bswap eax
mov ebx,eax

mov ecx,eax
mov bl,bh

shr ecx,16
mov ah,al

shr bl,4
shr al,4

and bh,0fh
and ah,0fh

shl ebx,16
and eax,0FFFFh

mov edx,ecx
mov cl,ch

mov dh,dl
shr cl,4

shr dl,4
and ch,0fh

and dh,0fh
shl ecx,16

lea eax,[eax][ebx]+30303030h
lea edx,[edx][ecx]+30303030h

mov [edi+10],eax
mov [edi+14],edx
xor esi,1
lea edi,[edi-8]
jne @B

mov ah,byte ptr [esp]
add edi,16
mov al,ah
add esp,2
shr al,4
mov esi,lBuffer
and eax,0f0fh
or eax,3030h
mov word ptr [edi],ax
cmp edi,esi
mov byte ptr [edi+18],0
jne @P
mov ecx,-20
add edi,19
@@:
inc ecx
cmp byte ptr [edi][ecx],30h
je @B
mov eax,ecx
js @Zero
neg eax
add esi,eax
@@: mov al,byte ptr [edi][ecx]
mov byte ptr [esi][ecx],al
inc ecx
jne @B

@P: ret
@Zero:
mov byte ptr [esi+1],0
jmp @P
uqw2a endp

end start
Posted on 2001-09-10 22:30:53 by The Svin
Here is one page of code:
Posted on 2001-09-11 21:55:07 by eet_1024
You wether don't know what my proc is doing or don't know what the proc you've posted doing or both.
With the same success you could have posted binary search algo in a reply about weather report.
As to the task the your proc perform I can share my proc wich does it ~ 60 times faster.
Posted on 2001-09-12 04:03:00 by The Svin
Alex,

I would appreciate it if you posted the algo as a file as the PHP in this forum messes up my Netscape and the code is hards to read and would have to be fully reformatted. If you could add commenting to it, many would appreciate it, the English does not have to be fancy, just so that people can understand it.

Regards,

hutch@pbq.com.au
Posted on 2001-09-12 08:44:28 by hutch--
With pleasure, Steve.
I've tried as I could.

PS: I found seveeral mistakes in my English in comments.
If only somebody with nice English could check and edit it...;)
Posted on 2001-09-13 23:40:26 by The Svin