The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Danesh on March 17, 2005, 12:29:15 AM

Title: Strings sorting
Post by: Danesh on March 17, 2005, 12:29:15 AM
Hi again all,

I am looking for a well-optimized routine to sort an array of strings. In MASM32 library there are some routines which sorts but they have been designed particularly for number and not strings. I have heared something about a string library which has been written by Donkey. Does it support string sorting ? If yes, can anybody help to get it ?

I am also working to a link-list in memory. For allocating memory I can use HeapAlloc, VirtualAlloc or Malloc of MASM32 library. However allocated memory may be more than 4 MB, do I think I can not allocate it from the heap. I want to know does Malloc function allocates memory from heap ? Also, is it an efficient way to allocate large amounts of memory from the heap ?

Thanks,

Danesh

Title: Re: Strings sorting
Post by: hutch-- on March 17, 2005, 03:24:18 AM
Danesh,

Get the later version of MASM32 as it has some high speed string sort procedures. Note this much that to use them you must not pass a NULL pointer string to them as they are not dsigned to handle NULL pointers. this means that to load the array of string handles, you must test for NULL strings as you load tha array.

These have been successfully tested on a gigabyte of string data and work fine.
Title: Re: Strings sorting
Post by: Danesh on March 17, 2005, 12:15:43 PM
Hi Hutch,

I have version 8.2 with the latest SP installed, does it have those functions ? Are they in MASM32 library functions ?

Thanks,

Danesh

Title: Re: Strings sorting
Post by: hutch-- on March 17, 2005, 01:01:37 PM
Danesh,

If you have the service pack for version 8.2, then look in the help file that came with it.


assort proc arr:DWORD,cnt:DWORD,rdi:DWORD    ; ascending version
dssort proc arr:DWORD,cnt:DWORD,rdi:DWORD    ; descending version


These two are hybrids, ypou can access the others in the MASM32 library that came with the service pack.