00018 void *memcpy(void *dst, const void *src, size_t len)
00019 {
00020 size_t i;
00021
00022 /*
00023 * memcpy does not support overlappi
I couldn't understand if part they do for integers. i < len/sizeof(long). Why is this calculation required ?
Because they are copying words, not individual bytes, in this case (as the comment says, it is an optimization - it requires less iterations and the CPU can handle word aligned data more efficiently).
len
is the number of bytes to copy, and sizeof(long)
is the size of a single word, so the number of elements to copy (means, loop iterations to execute) is len / sizeof(long)
.