Changeset a4683611
- Timestamp:
- Jun 2, 2017, 5:01:19 PM (7 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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 2c6c893
- Parents:
- 421a287
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib
r421a287 ra4683611 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 1 22:46:43 201713 // Update Count : 21 612 // Last Modified On : Fri Jun 2 15:51:03 2017 13 // Update Count : 218 14 14 // 15 15 … … 127 127 static inline forall( dtype T | sized(T) ) T * memset( T dest[], size_t dim, char c ) { 128 128 //printf( "X19\n" ); 129 return memset( dest, c, dim * sizeof(T) );129 return (void *)memset( dest, c, dim * sizeof(T) ); // C memset 130 130 } // memset 131 131 static inline forall( dtype T | sized(T) ) T * memcpy( T dest[], const T src[], size_t dim ) { -
src/tests/.expect/alloc.txt
r421a287 ra4683611 13 13 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 14 14 15 C realloc 4015 C realloc 16 16 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 17 CFA realloc 8817 CFA realloc 18 18 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 19 19 20 CFA resize alloc 4020 CFA resize alloc 21 21 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 22 CFA resize array alloc 8822 CFA resize array alloc 23 23 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 24 CFA resize array alloc 4024 CFA resize array alloc 25 25 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 26 CFA resize array alloc 40, fill26 CFA resize array alloc, fill 27 27 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 28 CFA resize array alloc 88, fill28 CFA resize array alloc, fill 29 29 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 30 CFA resize array alloc 40, fill30 CFA resize array alloc, fill 31 31 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 32 32 -
src/tests/alloc.c
r421a287 ra4683611 10 10 // Created On : Wed Feb 3 07:56:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 1 21:33:49201713 // Update Count : 31 512 // Last Modified On : Fri Jun 2 15:13:03 2017 13 // Update Count : 316 14 14 // 15 15 … … 87 87 p = (void *)realloc( p, dim * sizeof(*p) ); // C realloc 88 88 for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; } 89 printf( "C realloc %ld\n", malloc_usable_size( p ));89 printf( "C realloc\n" ); 90 90 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 91 91 printf( "\n" ); … … 93 93 p = realloc( p, 2 * dim * sizeof(*p) ); // CFA realloc 94 94 for ( int i = dim; i < 2 * dim; i += 1 ) { p[i] = 0x1010101; } 95 printf( "CFA realloc %ld\n", malloc_usable_size( p ));95 printf( "CFA realloc\n" ); 96 96 for ( int i = 0; i < 2 * dim; i += 1 ) { printf( "%#x ", p[i] ); } 97 97 printf( "\n" ); … … 104 104 p = alloc( p, dim ); // CFA resize array alloc 105 105 for ( int i = 0; i < dim; i += 1 ) { p[i] = 0xdeadbeef; } 106 printf( "CFA resize alloc %ld\n", malloc_usable_size( p ));106 printf( "CFA resize alloc\n" ); 107 107 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 108 108 printf( "\n" ); … … 110 110 p = alloc( p, 2 * dim ); // CFA resize array alloc 111 111 for ( int i = dim; i < 2 * dim; i += 1 ) { p[i] = 0x1010101; } 112 printf( "CFA resize array alloc %ld\n", malloc_usable_size( p ));112 printf( "CFA resize array alloc\n" ); 113 113 for ( int i = 0; i < 2 * dim; i += 1 ) { printf( "%#x ", p[i] ); } 114 114 printf( "\n" ); 115 115 116 116 p = alloc( p, dim ); // CFA array alloc 117 printf( "CFA resize array alloc %ld\n", malloc_usable_size( p ));117 printf( "CFA resize array alloc\n" ); 118 118 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 119 119 printf( "\n" ); … … 123 123 124 124 p = alloc( p, dim, fill ); // CFA array alloc, fill 125 printf( "CFA resize array alloc %ld, fill\n", malloc_usable_size( p ));125 printf( "CFA resize array alloc, fill\n" ); 126 126 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] ); } 127 127 printf( "\n" ); 128 128 129 129 p = alloc( p, 2 * dim, fill ); // CFA array alloc, fill 130 printf( "CFA resize array alloc %ld, fill\n", malloc_usable_size( p ));130 printf( "CFA resize array alloc, fill\n" ); 131 131 for ( int i = 0; i < 2 * dim; i += 1 ) { printf( "%#x ", p[i] ); } 132 132 printf( "\n" ); 133 133 134 134 p = alloc( p, dim, fill ); // CFA array alloc, fill 135 printf( "CFA resize array alloc %ld, fill\n", malloc_usable_size( p ));135 printf( "CFA resize array alloc, fill\n" ); 136 136 for ( int i = 0; i < dim; i += 1 ) { printf( "%#x ", p[i] );; } 137 137 printf( "\n" );
Note: See TracChangeset
for help on using the changeset viewer.