- Timestamp:
- Jul 27, 2018, 7:24:09 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 0300979
- Parents:
- f0b3f51
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib
rf0b3f51 rb9c04946 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 23 07:44:47201813 // Update Count : 34 112 // Last Modified On : Fri Jul 27 07:21:36 2018 13 // Update Count : 345 14 14 // 15 15 … … 19 19 extern "C" { 20 20 void * memalign( size_t align, size_t size ); // malloc.h 21 void * memset( void * dest, int c, size_t size );// string.h21 void * memset( void * dest, int fill, size_t size ); // string.h 22 22 void * memcpy( void * dest, const void * src, size_t size ); // string.h 23 23 void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA … … 127 127 // data, non-array types 128 128 129 T * memset( T * dest, char c) {130 return (T *)memset( dest, c, sizeof(T) );129 T * memset( T * dest, char fill ) { 130 return (T *)memset( dest, fill, sizeof(T) ); 131 131 } // memset 132 132 … … 139 139 // data, array types 140 140 141 T * memset( T dest[], size_t dim, char c) {142 return (T *)(void *)memset( dest, c, dim * sizeof(T) );// C memset143 } // memset144 145 T * memcpy( T dest[], const T src[], size_t dim ) {141 T * amemset( T dest[], char fill, size_t dim ) { 142 return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset 143 } // amemset 144 145 T * amemcpy( T dest[], const T src[], size_t dim ) { 146 146 return (T *)(void *)memcpy( dest, src, dim * sizeof(T) ); // C memcpy 147 } // memcpy147 } // amemcpy 148 148 } // distribution 149 149 … … 203 203 E * bsearchu( E key, const E * vals, size_t dim ); 204 204 size_t bsearchu( E key, const E * vals, size_t dim ); 205 206 void qsort( E * vals, size_t dim );207 205 } // distribution 208 206 … … 214 212 E * bsearchu( K key, const E * vals, size_t dim ); 215 213 size_t bsearchu( K key, const E * vals, size_t dim ); 214 } // distribution 215 216 forall( otype E | { int ?<?( E, E ); } ) { 217 void qsort( E * vals, size_t dim ); 216 218 } // distribution 217 219 -
src/tests/.expect/alloc.txt
rf0b3f51 rb9c04946 49 49 CFA array memset 50 50 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 51 CFA memcpy51 CFA array memcpy 52 52 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 53 53 -
src/tests/alloc.c
rf0b3f51 rb9c04946 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 25 09:09:43201813 // Update Count : 33 112 // Last Modified On : Thu Jul 26 20:58:05 2018 13 // Update Count : 334 14 14 // 15 15 … … 219 219 printf( "\n" ); 220 220 221 memset( sta, dim, fill );// CFA array memset, type safe221 amemset( sta, fill, dim ); // CFA array memset, type safe 222 222 printf( "CFA array memset\n" ); 223 223 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x %a, ", sta[i].x, sta[i].y ); } 224 224 printf( "\n" ); 225 225 226 memcpy( sta1, sta, dim );// CFA array memcpy, type safe227 printf( "CFA memcpy\n" );226 amemcpy( sta1, sta, dim ); // CFA array memcpy, type safe 227 printf( "CFA array memcpy\n" ); 228 228 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x %a, ", sta1[i].x, sta1[i].y ); } 229 229 printf( "\n" );
Note: See TracChangeset
for help on using the changeset viewer.