That is pretty fast! I managed to add the sort to a little library (attached), here is a test:
#include <stdio.h>
#include <windows.h> // MessageBox
#pragma warn(disable:2216) // retval never used
#pragma warn(disable:2118) // para not referenced
#pragma comment(lib, "\\Masm32\\MasmBasic\\Res\\xTimer.lib") // adjust to your path
extern void __cdecl xTimerStart(void); // uses QPC and returns
extern int __stdcall xTimerEnd(void); // microseconds
extern int __stdcall MbArrSort(int*pStart, int elements, int pKey, int mode); // MasmBasic ArraySort
int main(int argc, char* argv[]) {
int i, MyArr[6]={123, 789, 456, 111, 333, 222};
xTimerStart();
// mode=size (4, 8 ) or (32 and real) or (64 and ascending)
MbArrSort(&MyArr[0], 6, 0, 4+64); // size 4, integer, ascending
printf("Sorting took %i microseconds\n", xTimerEnd());
for ( i=0; i<6; i++ ) printf("%i\t%i\n", i, MyArr[ i ] )
return MessageBox(0, "Sorted?", "Confirm:", MB_YESNO | MB_ICONINFORMATION);
}
What is rather odd is that the linker can't find MbArrSort unless xTimerStart is also being used. I often call assembler routines from C, it always works, and sort and timer are not connected in any way, so for the time being it's a mystery...
MbArrSort handles also QWORD, float and double arrays, see the mode comment.