News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

QWORD to ASCII and vice-versa

Started by raymond, January 25, 2007, 03:30:23 AM

Previous topic - Next topic

raymond

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]
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

hutch--

Thanks for posting these two algos Ray, they look great and should be really useful.  :U
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Dark Schneider

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: