Update on FASTPROC unicode procedures.

Started by hutch--, May 28, 2011, 03:29:24 AM

Previous topic - Next topic

hutch--

The updated version has 12 procedures that are primarily designed to be called from other assembler procedures. They differ from basic string procedures in that those that modify strings modify the string passed to it. The calling procedures need to be Intel ABI compliant (register preservation rules).

The advantage of procedures of this type is they do not repeatedly re-allocate strings and if you are familiar with working with zero terminated strings, you allocate a big enough buffer the first time then perform as many string functions as you need without reallocation overhead.

A number of the procedures could be made faster by various techniques like unrolling or in some cases redesign but for dedicated UNICODE string operations most of these procedures are reasonably fast.

All bar the uc_find procedure are written without a stack frame to minimise the call overhead, the uc_find procedure has a manually coded stack frame as it requires LOCAL variables. Note also that the uc_multicat procedure uses a true C VARARG calling convention due to its capacity to handle a variable number of strings and this involves manually balancing the stack from the caller end.


----------------------------------------
UNICODE zero terminated string functions
----------------------------------------

NOTE : The functions that change the string MODIFY
       the original string passed to it.

uc_len          return the character count of a unicode string
uc_left         truncates a string to a given character count
uc_right        truncates a string from the right side
uc_reverse      reverse a unicode string
uc_ltrim        left trim tabs and spaces from a unicode string
uc_rtrim        right trim tabs and spaces from a unicode string
uc_trim         left and right trim unicode string
uc_cmp          compare two unicode strings
uc_cat          join one string to the end of another
uc_multicat     join multiple strings to the end of a string
uc_find         find a unicode sub-string in a main string
uc_append       loop append unicode string function
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php