Messages in this thread | | | Subject | Re: [PATCH] Repalce strncmp by memcmp | From | Bernd Petrovitsch <> | Date | Tue, 30 Nov 2010 11:34:20 +0100 |
| |
On Mon, 2010-11-29 at 05:09 +0300, Pavel Vasilyev wrote: > This patch replace all strncmp(a, b, c) by memcmp(a, b, c). > > I test on x86_64 (AMD Opteron 285). > > #include <string.h> > char *A = "0000"; > void test_memcmp(void) { > memcmp(A, "TEST", 4); > } > void test_strn(void) { > strncmp(A, "TEST", 4); > } [...]
You use constant parameters with user-space functions defined by the C-standard on one architecture (and CPU?) - and even worse the width is 4 so - for the memcmp() case - it boilsdown to a comparison of unsigned ints. So that example is (also) completely worthless.
Bernd -- Bernd Petrovitsch Email : bernd@petrovitsch.priv.at LUGA : http://www.luga.at
| |