The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: raymond on January 25, 2007, 03:30:23 AM

Title: QWORD to ASCII and vice-versa
Post by: raymond on January 25, 2007, 03:30:23 AM
I've seen a few posts lately related to the qword conversion to/from ascii. I'm attaching the source code of both of my procedures separately. Both make use of the FPU instructions related to packed BCDs for part of the conversion.

The qword2a proc handles the entire range of signed qwords,
including the 8000000000000000h which yields -9223372036854775808.
I've tested it with numerous different input and results all seem OK. As for speed, the proc will be slowest when the resulting string would contain 19 numerical digits.
I have not included any code to convert a dword to ascii when that could be an option. However, the speed may still be competitive with other procs handling only signed dword-to-ascii conversions.

The ascii2qw proc also handles all the strings producing the entire range of signed qwords,
the only exception being the -9223372036854775808 string.
I've also tested it with numerous different input and results all seem OK. As for speed, this proc will also be slowest when the source string contains 19 numerical digits. Error checking on the input string is fully covered.

Any further testing for accuracy is definitely welcomed. Any speed comparison with other available procs may also be useful.

Raymond



[attachment deleted by admin]
Title: Re: QWORD to ASCII and vice-versa
Post by: hutch-- on January 25, 2007, 04:59:12 AM
Thanks for posting these two algos Ray, they look great and should be really useful.  :U
Title: Re: QWORD to ASCII and vice-versa
Post by: Dark Schneider on January 25, 2007, 06:18:49 AM
That's what I'm looking for! :U

But what about unsigned qword?

BTW. Maximum positive signed qword is enough for my little proc, thank you. :clap: