Changeset a2ae4f4 in mainline for libc/generic/string.c
- Timestamp:
- 2006-06-01T14:22:33Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88c3151
- Parents:
- cf28036
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libc/generic/string.c
rcf28036 ra2ae4f4 43 43 } 44 44 45 void * memcpy(void *dest, void *src, size_t n) 46 { 47 char *os = src; 48 char *odst = dest; 49 while (n--) 50 *(odst++) = *(os++); 51 return dest; 52 } 45 void * memcpy(void *dst, const void *src, size_t n) 46 { 47 int i, j; 48 49 for (i = 0; i < n/sizeof(unsigned long); i++) 50 ((unsigned long *) dst)[i] = ((unsigned long *) src)[i]; 51 52 for (j = 0; j < n%sizeof(unsigned long); j++) 53 ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j]; 54 55 return (char *)src; 56 } 57 58 void * memmove(void *dst, const void *src, size_t n) 59 { 60 int i, j; 61 62 if (src > dst) 63 return memcpy(dst, src, n); 64 65 for (j = (n%sizeof(unsigned long))-1; j >= 0; j--) 66 ((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j]; 67 68 for (i = n/sizeof(unsigned long)-1; i >=0 ; i--) 69 ((unsigned long *) dst)[i] = ((unsigned long *) src)[i]; 70 71 return (char *)src; 72 } 73 53 74 54 75 /** Count the number of characters in the string, not including terminating 0.
Note:
See TracChangeset
for help on using the changeset viewer.