fa57ac79be6e0f0188bc80f5ae81563dd5e57864
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

1) #include "memcpy.h"
2) 
3) /**
4)  * @brief copy memory
5)  * @param[in] dest pointer to destination buffer
6)  * @param[in] src pointer to source data
7)  * @param[in] sz size of data to copy
8)  */
9) void memcpy(void *dest, const void *src, unsigned int sz)
10) {
11)   unsigned int *dest4;
12)   const unsigned int *src4;
13)   unsigned int sz4;
14)   unsigned char *dest1;
15)   const unsigned char *src1;
16) 
17)   // word aligned memory addresses -> fast copy
18)   if (((unsigned int)dest & 3) == 0 && ((unsigned int)src & 3) == 0) {
19)     dest4 = dest;
20)     src4 = src;
Stefan Schuermans fixed memcpy (it coppied to...

Stefan Schuermans authored 12 years ago

21)     sz4 = sz >> 2;
22)     for ( ; sz4 > 0; --sz4)
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

23)       *dest4++ = *src4++;
Stefan Schuermans fixed memcpy (it coppied to...

Stefan Schuermans authored 12 years ago

24)     // there might still be a few bytes to copy now
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

25)     dest = dest4;
26)     src = src4;
Stefan Schuermans fixed memcpy (it coppied to...

Stefan Schuermans authored 12 years ago

27)     sz &= 3;