From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: sk malik <srikrishanmalik@yahoo.co.in>
Cc: linux-kernel@vger.kernel.org
Subject: Re: why use memcpy when memmove is there?
Date: Mon, 13 Aug 2007 17:02:43 +0200 [thread overview]
Message-ID: <46C07293.5090405@s5r6.in-berlin.de> (raw)
In-Reply-To: <977159.24669.qm@web7606.mail.in.yahoo.com>
sk malik wrote:
> memcpy copies a part of memory to some other location
> but It will not work for all cases of overlapping
> blocks.(if the start of destination block falls
> between the source block)
>
> while memove copes with overlapping areas.
>
> then why is memcpy present in the sources can't we
> simply do
>
> "#define memcpy memmove" in include/linux/string.h
>
> or am I missing something?
The restriction that memcpy is undefined for overlapping areas (IOW, is
only defined for non-overlapping areas) can be used for optimizations in
memcpy which are not possible in memmove. An example, I suppose:
http://lxr.linux.no/source/arch/m68k/lib/string.c#L79
http://lxr.linux.no/source/arch/m68k/lib/string.c#L146
--
Stefan Richter
-=====-=-=== =--- -==-=
http://arcgraph.de/sr/
next prev parent reply other threads:[~2007-08-13 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-13 10:55 sk malik
2007-08-13 14:15 ` Jan Engelhardt
2007-08-13 15:02 ` Stefan Richter [this message]
2007-08-14 21:59 ` David Schwartz
[not found] <fa.tH0XPZg4jvmqSQh3iOmzbwrRN9Y@ifi.uio.no>
2007-08-13 14:33 ` Robert Hancock
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=46C07293.5090405@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=srikrishanmalik@yahoo.co.in \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®