nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
memcpy.c
Go to the documentation of this file.
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <string.h>
4 
5 void memcpy(void *dest, void *src, size_t size)
6 {
7  register unsigned long * __restrict__ word_dest;
8  register unsigned long * __restrict__ word_src;
9  register unsigned char * __restrict__ byte_dest;
10  register unsigned char * __restrict__ byte_src;
11 
12  word_dest = dest;
13  word_src = src;
14  while (size > sizeof(*word_dest)) {
15  *word_dest++ = *word_src++;
16  size -= sizeof(*word_dest);
17  }
18 
19  byte_dest = (unsigned char*)word_dest;
20  byte_src = (unsigned char*)word_src;
21  while (size-- > 0) {
22  *byte_dest++ = *byte_src++;
23  }
24 }
25 
26 /* End of a file */