aboutsummaryrefslogtreecommitdiff
path: root/lib/memcpy.c
blob: c648501f270a866c381a97585c9e2854325702a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * The  memcpy()  function copies n bytes from memory area src to memory area dest.  The memory areas must not overlap.
 * @param dest
 * @param src
 * @param n
 * @return
 */
void *
memcpy(void *restrict dest, const void *restrict src, unsigned n)
{
  char *pDest = (char *)dest;
  const char *pSrc = (const char *)src;

  while (n) {
    *(pDest++) = *(pSrc++);
    --n;
  }

  return dest;
}