Author Topic: String funtion szCmpi and Cmpi  (Read 4301 times)

ale7712molon

  • Guest
String funtion szCmpi and Cmpi
« 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

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4813
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: String funtion szCmpi and Cmpi
« Reply #1 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: String funtion szCmpi and Cmpi
« Reply #2 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

ale7712molon

  • Guest
Re: String funtion szCmpi and Cmpi
« Reply #3 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

jj2007

  • Member
  • *****
  • Posts: 7552
  • Assembler is fun ;-)
    • MasmBasic
Re: String funtion szCmpi and Cmpi
« Reply #4 on: June 06, 2012, 12:17:42 AM »
\Masm32\m32lib\szcmpi.asm

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: String funtion szCmpi and Cmpi
« Reply #5 on: June 06, 2012, 12:27:35 AM »
they use a table because it is a case-insensitive comparison of strings

leebar1983

  • Guest
Re: String funtion szCmpi and Cmpi
« Reply #6 on: June 12, 2012, 05:35:59 PM »
Ok thanks. I was wondering about this myself.

jj2007

  • Member
  • *****
  • Posts: 7552
  • Assembler is fun ;-)
    • MasmBasic
Re: String funtion szCmpi and Cmpi
« Reply #7 on: June 12, 2012, 06:52:54 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:
Code: [Select]
invoke szCmp, esi, edi
invoke szCmpi, esi, edi, len(esi)

Here is a test piece with timings.
Code: [Select]
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