On Tue, 2007-08-14 at 16:23 +0530, pradeep singh wrote: > On 8/14/07, arshad hussain <arshad.super@xxxxxxxxx> wrote: > [snip] > > > 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? > > I don't know but memcpy generates better asm code AFAIK. > Essentially memove is nothing but > int memmove(void *dest, void *src, size_t n) > { > //some checks > //some adjustments to src and destination as they may overlap as per > //definition. > > memcpy(dest, src, n); > > } It's more like: if (dest <= src) do what memcpy does else do basically memcpy, just backwards If you know that you don't have overlap, you can save yourself a conditional jump. Not the biggest optimization, but it can add up if you call it often, and it's easy, so you might as well take advantage of it. Avishay -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ