Changeset 7f079d9 in mainline for libc/generic/string.c
- Timestamp:
- 2006-06-03T01:24:33Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0861786
- Parents:
- 6c46350
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libc/generic/string.c
r6c46350 r7f079d9 31 31 #include <ctype.h> 32 32 #include <limits.h> 33 #include <align.h> 33 34 34 35 … … 43 44 } 44 45 46 struct along {unsigned long n; } __attribute__ ((packed)); 47 48 static void * unaligned_memcpy(void *dst, const void *src, size_t n) 49 { 50 int i, j; 51 struct along *adst = dst; 52 const struct along *asrc = src; 53 54 for (i = 0; i < n/sizeof(unsigned long); i++) 55 adst[i].n = asrc[i].n; 56 57 for (j = 0; j < n%sizeof(unsigned long); j++) 58 ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j]; 59 60 return (char *)src; 61 } 62 45 63 void * memcpy(void *dst, const void *src, size_t n) 46 64 { 47 65 int i, j; 66 67 if (((long)dst & (sizeof(long)-1)) || ((long)src & (sizeof(long)-1))) 68 return unaligned_memcpy(dst, src, n); 48 69 49 70 for (i = 0; i < n/sizeof(unsigned long); i++)
Note:
See TracChangeset
for help on using the changeset viewer.