All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] what is best: memcpy or for
@ 2006-12-06  7:35 Daniel Marjamäki
  2006-12-06  8:34 ` Christophe Lucas
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Daniel Marjamäki @ 2006-12-06  7:35 UTC (permalink / raw)
  To: kernel-janitors

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?

Best regards,
Daniel
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-07  4:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-06  7:35 [KJ] what is best: memcpy or for Daniel Marjamäki
2006-12-06  8:34 ` Christophe Lucas
2006-12-06 14:13 ` Matthew Wilcox
2006-12-06 15:25 ` Neil Horman
2006-12-07  4:59 ` Anupam Kapoor

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.