This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
strcmp
- From: Stéphane FORNENGO <sfornengo at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Tue, 19 Apr 2011 20:53:53 +0200
- Subject: strcmp
Hi,
may be a stupid question but reading the source code of
string/strcmp.c I wonder why not using word comparaisons rather than
byte to byte comparaisons.
We could also use the same "magic" as in strlen to detect '\0'.
I am just surprised that the current code realizes not less than 17
comparaisons for two 8 character strings for example... as it seems
rapidely it could be reduce to just one long word (64 bits)
comparison.