Changeset 178 for soft/giet_vm/libs/common.h
- Timestamp:
- Jul 22, 2012, 12:06:11 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/libs/common.h
r176 r178 1 1 ////////////////////////////////////////////////////////////////////////////////// 2 // File : common.h3 // Date : 20/07/20124 // Author: mohamed karaoui2 // File : common.h 3 // Date : 20/07/2012 4 // Maintener : mohamed karaoui 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// … … 8 8 #ifndef _COMMON_H_ 9 9 #define _COMMON_H_ 10 11 /* 12 * memcpy, memset function 13 * This function is required because it can be gnerated by GCC 14 * during compilation so we must provide it. 15 * Code taken from MutekH. 16 */ 17 ////////////////////////////////////////////////////////////////////////// 18 static inline void *memcpy(void *_dst, const void *_src, unsigned int size) 19 { 20 unsigned int *dst = _dst; 21 const unsigned int *src = _src; 22 23 /* if source and destination buffer are word-aligned, 24 * then copy word-by-word */ 25 if (!((unsigned int)dst & 3) && !((unsigned int)src & 3)) 26 while (size > 3) { 27 *dst++ = *src++; 28 size -= 4; 29 } 30 31 unsigned char *cdst = (unsigned char*)dst; 32 unsigned char *csrc = (unsigned char*)src; 33 34 /* byte-by-byte copy */ 35 while (size--) { 36 *cdst++ = *csrc++; 37 } 38 return _dst; 39 } 40 41 ////////////////////////////////////////////////////////// 42 static inline void * memset(void *dst, int s, unsigned int count) 43 { 44 char *a = (char *) dst; 45 while (count--) 46 *a++ = (char)s; 47 return dst; 48 } 10 49 11 50 /** … … 26 65 Taken from Mutekh(SRL API) 27 66 */ 28 29 67 static inline void __abort() 30 68 { … … 33 71 } 34 72 35 ////////////////////////////////////////////////////////////////////////////////////////36 // mempcy()37 // GCC may requires this function. Taken from MutekH.38 ////////////////////////////////////////////////////////////////////////////////////////39 void *memcpy(void *_dst, const void *_src, unsigned int size);40 41 ////////////////////////////////////////////////////////////////////////////////////////42 // memset()43 // GCC may requires this function. Taken from MutekH.44 ////////////////////////////////////////////////////////////////////////////////////////45 inline void * memset(void *dst, int s, unsigned int count);46 47 73 #endif /* _COMMON_H_ */
Note: See TracChangeset
for help on using the changeset viewer.