News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Two sort algos.

Started by hutch--, July 07, 2017, 05:16:27 PM

Previous topic - Next topic

hutch--

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.

jj2007

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?

hutch--

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.

jj2007

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.

nidud

#4
deleted