Ascii to DWORD/LONG and back modules for MASM32 library.

Started by hutch--, November 20, 2010, 01:12:53 AM

Previous topic - Next topic

hutch--

The attached zip file has 8 algorithms that are destined for the MASM32 library. There are 4 basic functions presented in 2 forms, normal and "_ex" versions that may be faster on some hardware where in fact speed is required for conversions of this type. because there have been a few odd problems with conversions before these have all been tested exhaustively over the respective signed and unsigned DWORD range and test as reliable. A number of the modules owe their original to both Ray Filiatreault and Paul Dixon with minor modifications to suit the MASM32 interface. I have written the credit for the algorithm designs into each module that they have originally designed.

There is no documentation for these algos yet so you will need to have a look at the algos to get the arguments but its no big deal to do.

These are the prototypes.

    atol PROTO :DWORD
    atol_ex PROTO :DWORD
    atou PROTO :DWORD
    atou_ex PROTO :DWORD
    ltoa PROTO :DWORD,:DWORD
    ltoa_ex PROTO :DWORD,:DWORD
    utoa PROTO :DWORD,:DWORD
    utoa_ex PROTO :DWORD,:DWORD
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

Here is a benchmark to test three algos,


    utoa
    utoa_ex
    udw2str


Ray's compact code is about twice as fast as the old "udw2str" algo and Paul Dixon's extended version is much faster again.

With apologies I have not yet added a clipboard copy procedure to the benchmark, that will come later when I have a bit more time.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007


frktons

Quote from: hutch-- on November 20, 2010, 03:00:46 AM
Here is a benchmark to test three algos,


    utoa
    utoa_ex
    udw2str


Ray's compact code is about twice as fast as the old "udw2str" algo and Paul Dixon's extended version is much faster again.

With apologies I have not yet added a clipboard copy procedure to the benchmark, that will come later when I have a bit more time.

I'm glad to see the threads on the new testbed are producing some effects:


Well, don't download the attached zip, it is just the image renamed to post it on the forum.  :P
Mind is like a parachute. You know what to do in order to use it :-)

hutch--

Frank,

What OS have you run this one, the interface looks like Win2000 or with no manifest file on XP ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

frktons

Quote from: hutch-- on November 20, 2010, 09:57:06 AM
Frank,

What OS have you run this one, the interface looks like Win2000 or with no manifest file on XP ?

Win7/64 bit ultimate edition.  May I suggest you inserting the display of the OS/CPU on the
Box?
Mind is like a parachute. You know what to do in order to use it :-)

hutch--

Frank,

I am more interested in the algos than the benchmark. I have been writing benchmarks for the last 20 years so they are only as important to me as the algos they test. This is only a simple dialog using common controls, not an artwork like your text mode interface.

This is what the dialog looks like on my Win7 64 Ultimate. You must have something turned off on your version or installation.

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

brethren

results on mine:


utoa : 670
utoa_ex: 205
udw2str: 765
u32toa: 437 (added mine to the test :P)



i reckon its the xchg instruction that slows down udw2str

frktons

Quote from: hutch-- on November 20, 2010, 11:01:27 AM
Frank,

I am more interested in the algos than the benchmark. I have been writing benchmarks for the last 20 years so they are only as important to me as the algos they test. This is only a simple dialog using common controls, not an artwork like your text mode interface.

... You must have something turned off on your version or installation.

Yes Steve. I turned off everything, aero, fancy video display, to get a simple straight old fashioned and fast display  :P
Mind is like a parachute. You know what to do in order to use it :-)

hutch--

 :bg

I wondered what had happened, I knew you were using Win7 64 but I thought you must have had an old timer planted somewhere.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

frktons

Quote from: hutch-- on November 21, 2010, 09:55:54 PM
:bg
I wondered what had happened, I knew you were using Win7 64 but I thought you must have had an old timer planted somewhere.

I've some more machine somewhere with XP pro SP3, in my office, and under the desk [not desk-top]  :lol

Sometime I switch to these machines at work or at home, but not that often.  :P

Frank
Mind is like a parachute. You know what to do in order to use it :-)