home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1897
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
1KB
From: sartin@hplabsz.HPL.HP.COM (Rob Sartin)
Newsgroups: alt.sources
Subject: Re: Fast strcmp() wanted.
Message-ID: <6003@hplabsz.HPL.HP.COM>
Date: 3 Oct 90 19:33:38 GMT
In article <CEDMAN.90Sep29091115@lynx.ps.uci.edu> cedman@lynx.ps.uci.edu (Carl Edman) writes:
>string structure (or better class, long live C++ ! :-) which calculates
>a 32-bit CRC for each string the first time and stores it somewhere.
>Then only 1 (inlined) longword-compare will do the stringcomparisons
>for you.
Afraid not. It'll give you an estimate of whether the strings match
(correctly identifying those that don't). You will need to then
actually compare the strings if they are the same. This method will
also be unable to reproduce strcmp's behavior (strcmp returns a signed
result indicated the <, =, > by being negative, zero, positive), it will
only return a boolean (match, no match).
If you do lots of string comparisons strictly for equality/inequality it
might be worth investigating.
Rob Sartin uucp: hplabs!sartin
"Some may say that I have gone astray. internet: sartin@hplabs.hp.com
How would they know? They never follow."