strcmp

Stéphane FORNENGO sfornengo@gmail.com
Tue Apr 19 19:00:00 GMT 2011


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.



More information about the Libc-help mailing list