Changeset 113
- Timestamp:
- Jun 30, 2017, 11:03:08 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_acpi.c
r89 r113 33 33 #include <core.h> 34 34 #include <cluster.h> 35 36 /* XXX XXX libk XXX XXX */37 int memcmp(char *s1, char *s2, size_t n)38 {39 size_t i;40 for(i = 0; i < n; i++) {41 if (s1[i] != s2[i])42 return 1;43 }44 return 0;45 }46 35 47 36 /* -------------------------------------------------------------------------- */ -
trunk/kernel/libk/memcpy.c
r11 r113 28 28 void * memcpy( void * dst, 29 29 const void * src, 30 uint32_t size) 30 uint32_t size) 31 31 { 32 32 uint32_t * wdst = dst; … … 36 36 if (!((uint32_t) wdst & 3) && !((uint32_t) wsrc & 3) ) 37 37 { 38 while (size > 3) 38 while (size > 3) 39 39 { 40 40 *wdst++ = *wsrc++; … … 47 47 48 48 // byte per byte for last bytes (or not aligned) 49 while (size--) 49 while (size--) 50 50 { 51 51 *cdst++ = *csrc++; … … 55 55 56 56 ////////////////////////////// 57 void * memset( void * dst, 57 void * memset( void * dst, 58 58 uint32_t val, 59 uint32_t size) 59 uint32_t size) 60 60 { 61 61 // build 8 bits and 32 bits values … … 86 86 } 87 87 88 ////////////////////////////// 89 int memcmp( const void * s1, 90 const void * s2, 91 uint32_t n) 92 { 93 const uint8_t * cs1 = s1; 94 const uint8_t * cs2 = s2; 95 96 while (n > 0) 97 { 98 if (*cs1++ != *cs2++) 99 return (*--cs1 - *--cs2); 100 n--; 101 } 102 return 0; 103 } 104 -
trunk/kernel/libk/memcpy.h
r11 r113 27 27 /******************************************************************************************* 28 28 * This function copies a source buffer to a destination buffer. 29 * There is no alignment constraint, but the performance s are improved if thbuffers30 * are both aligned on a 32 bits word boundary. 29 * There is no alignment constraint, but the performance is improved if the buffers 30 * are both aligned on a 32 bits word boundary. 31 31 ******************************************************************************************* 32 32 * @ dst : pointer on destination buffer. … … 37 37 void * memcpy( void * dst, 38 38 const void * src, 39 uint32_t size ); 39 uint32_t size ); 40 40 41 41 /******************************************************************************************* 42 * This function set a constant value in each byte of a target buffer.42 * This function sets a constant value in each byte of a target buffer. 43 43 ******************************************************************************************* 44 44 * @ dst : pointer on destination buffer. 45 * @ val : constant value (cast edto uint8_t).45 * @ val : constant value (cast to uint8_t). 46 46 * @ size : number of bytes. 47 47 * @ return pointer on destination buffer. 48 48 ******************************************************************************************/ 49 void * memset( void * dst, 49 void * memset( void * dst, 50 50 uint32_t val, 51 uint32_t size); 51 uint32_t size); 52 52 53 /******************************************************************************************* 54 * TODO 55 ******************************************************************************************/ 56 int memcmp( const void * s1, 57 const void * s2, 58 uint32_t n); 59
Note: See TracChangeset
for help on using the changeset viewer.