The MASM Forum

General => The Workshop => Topic started by: ale7712molon on June 04, 2012, 01:20:18 PM

Title: String funtion szCmpi and Cmpi
Post by: ale7712molon on June 04, 2012, 01:20:18 PM
thank for u time

I need an example of using the String function szCmpi and Cmpi, i need to know the sintaxis

i dont know  where  store the return value

please help me
Title: Re: String funtion szCmpi and Cmpi
Post by: hutch-- on June 04, 2012, 02:14:37 PM
Have a look at the source code, its in the m32 directory and the documentation is in the help file.
Title: Re: String funtion szCmpi and Cmpi
Post by: dedndave on June 04, 2012, 11:08:25 PM
you don't necessarily need to store the result
it is a zero or non-zero value, indicating whether or not a match was found
Title: Re: String funtion szCmpi and Cmpi
Post by: ale7712molon on June 06, 2012, 12:11:35 AM
ok thank for u answer, but i need to know about szCmpi,  the source code for this function is located 

masm32\m32lib , i dont know why not because they use a table
Title: Re: String funtion szCmpi and Cmpi
Post by: jj2007 on June 06, 2012, 12:17:42 AM
\Masm32\m32lib\szcmpi.asm
Title: Re: String funtion szCmpi and Cmpi
Post by: dedndave on June 06, 2012, 12:27:35 AM
they use a table because it is a case-insensitive comparison of strings
Title: Re: String funtion szCmpi and Cmpi
Post by: leebar1983 on June 12, 2012, 05:35:59 PM
Ok thanks. I was wondering about this myself.
Title: Re: String funtion szCmpi and Cmpi
Post by: jj2007 on June 12, 2012, 06:52:54 PM
Quote from: ale7712molon on June 04, 2012, 01:20:18 PM
I need an example of using the String function szCmpi and Cmpi, i need to know the sintaxis

Syntax is different for the two versions:
invoke szCmp, esi, edi
invoke szCmpi, esi, edi, len(esi)


Here is a test piece with timings.
StringsDiffer:  different at pos 98 (case-sensitive, zero-based)
StringsDiffer:  different at pos 99 (case-insensitive)
szCmp:          different (position not returned)
szCmpi:         different at pos 100 (case-sensitive, one-based)

AMD Athlon(tm) Dual Core Processor 4450B (SSE3)
105     cycles for StringsDiffer, case-sensitive
113     cycles for StringsDiffer, case-insensitive
255     cycles for szCmp
670     cycles for szCmpi, MasmBasic Len
774     cycles for szCmpi, Masm32 len

104     cycles for StringsDiffer, case-sensitive
113     cycles for StringsDiffer, case-insensitive
249     cycles for szCmp
685     cycles for szCmpi, MasmBasic Len
774     cycles for szCmpi, Masm32 len