The MASM Forum

Microsoft 64 bit MASM => Examples => Topic started by: hutch-- on July 07, 2017, 05:16:27 PM

Title: Two sort algos.
Post by: hutch-- on July 07, 2017, 05:16:27 PM
I have started to convert some of the simpler sorts from the 32 bit versions to 64 bit MASM, the first is a bubble sort which is about as useful as a hip pocket in a singlet in all but a few specialised instances and an insertion sort which is suitable for small counts, both have their uses in hybrid sort algos that use more than one design, these two are basically "trimmer" algos that address a problem with more complex sorts that handle large data but are a bit clunky on small counts, something common with quick sorts.

I have yet to convert any of the quick sort designs as stack recursion with the Win64 ABI is not immediately a simple task where you can keep dumping stack parameters with each ascending iteration as you could in Win32.
Title: Re: Two sort algos.
Post by: jj2007 on July 07, 2017, 06:51:51 PM
Quote from: hutch-- on July 07, 2017, 05:16:27 PMstack recursion with the Win64 ABI is not immediately a simple task where you can keep dumping stack parameters with each ascending iteration as you could in Win32.

As long as you don't call a Windows API inside the sort proc, you can do whatever you want, no?
Title: Re: Two sort algos.
Post by: hutch-- on July 07, 2017, 08:28:26 PM
I have to think about that one, there has to be a way to do it as the shadow space for the registers will persist after each iteration but its likely that there will need to be a lot more stack space.
Title: Re: Two sort algos.
Post by: jj2007 on July 07, 2017, 08:56:56 PM
Quote from: hutch-- on July 07, 2017, 08:28:26 PMas the shadow space for the registers will persist

You write an entry proc that handles shadow space according to the ABI but then calls the "real" recursive sort proc with no restrictions.
Title: Re: Two sort algos.
Post by: nidud on July 08, 2017, 01:13:38 AM
deleted