From: Christophe Lucas <clucas@rotomalug.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] what is best: memcpy or for
Date: Wed, 06 Dec 2006 08:34:48 +0000 [thread overview]
Message-ID: <20061206083448.GE24594@rotomalug.org> (raw)
In-Reply-To: <80ec54e90612052335v3688faedj6c64f979d420c078@mail.gmail.com>
Daniel Marjamäki (daniel.marjamaki@gmail.com) wrote:
> Hello!
>
> I am wondering if there is any real difference between "for" and "memcpy"..
>
> int i, a[100], b[100];
>
> // method 1
> for (i = 0; i < 100; i++)
> a[i] = b[i];
>
> // method 2
> memcpy(a, b, sizeof(a));
>
> Is there any difference in speed?
>
> With a good compiler, the output should be the same for both methods,
> shouldn't it?
Hi,
Perhaps I say mistake, but in kernel terms :
http://lxr.linux.no/source/include/asm-i386/string.h?v=2.6.18#L203
regards,
Christophe
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2006-12-06 8:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 7:35 [KJ] what is best: memcpy or for Daniel Marjamäki
2006-12-06 8:34 ` Christophe Lucas [this message]
2006-12-06 14:13 ` Matthew Wilcox
2006-12-06 15:25 ` Neil Horman
2006-12-07 4:59 ` Anupam Kapoor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061206083448.GE24594@rotomalug.org \
--to=clucas@rotomalug.org \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.