lkml.org 
[lkml]   [2010]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Repalce strncmp by memcmp
From
Date
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



\
 
 \ /
  Last update: 2010-11-30 11:37    [W:0.094 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site