- Timestamp:
- 2013-04-10T19:11:45Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dd0c8a0
- Parents:
- 44186b01 (diff), b4f43a1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- boot/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/generic/include/memstr.h
r44186b01 r3deb0155 35 35 #include <typedefs.h> 36 36 37 extern void *memcpy(void *, const void *, size_t); 37 extern void *memcpy(void *, const void *, size_t) 38 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); 39 extern void *memset(void *, int, size_t) 40 __attribute__ ((optimize("-fno-tree-loop-distribute-patterns"))); 38 41 extern void *memmove(void *, const void *, size_t); 39 42 -
boot/generic/src/memstr.c
r44186b01 r3deb0155 30 30 #include <typedefs.h> 31 31 32 /** Copy block of memory.32 /** Move memory block without overlapping. 33 33 * 34 * Copy cnt bytes from src address to dst address. The source and destination35 * memory areas cannot overlap.34 * Copy cnt bytes from src address to dst address. The source 35 * and destination memory areas cannot overlap. 36 36 * 37 * @param src Source address to copy from.38 * @param dst Destination address to copy to.39 * @param cnt 37 * @param dst Destination address to copy to. 38 * @param src Source address to copy from. 39 * @param cnt Number of bytes to copy. 40 40 * 41 * @return Destination address. 41 * @return Destination address. 42 * 42 43 */ 43 44 void *memcpy(void *dst, const void *src, size_t cnt) 44 45 { 45 size_t i; 46 uint8_t *dp = (uint8_t *) dst; 47 const uint8_t *sp = (uint8_t *) src; 48 49 while (cnt-- != 0) 50 *dp++ = *sp++; 51 52 return dst; 53 } 46 54 47 for (i = 0; i < cnt; i++) 48 ((uint8_t *) dst)[i] = ((uint8_t *) src)[i]; 49 55 /** Fill block of memory. 56 * 57 * Fill cnt bytes at dst address with the value val. 58 * 59 * @param dst Destination address to fill. 60 * @param val Value to fill. 61 * @param cnt Number of bytes to fill. 62 * 63 * @return Destination address. 64 * 65 */ 66 void *memset(void *dst, int val, size_t cnt) 67 { 68 uint8_t *dp = (uint8_t *) dst; 69 70 while (cnt-- != 0) 71 *dp++ = val; 72 50 73 return dst; 51 74 }
Note:
See TracChangeset
for help on using the changeset viewer.