Changes in src/libcfa/stdlib.c [a797e2b1:627f585]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib.c
ra797e2b1 r627f585 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // algorithm.c -- 7 // algorithm.c -- 8 8 // 9 9 // Author : Peter A. Buhr … … 78 78 } // posix_memalign 79 79 80 forall( otype T, ttype Params | { void ?{}(T *, Params); } ) 81 T * new( Params p ) { 82 return ((T*)malloc()){ p }; 83 } 84 85 forall( dtype T | { void ^?{}(T *); } ) 86 void delete( T * ptr ) { 87 if ( ptr ) { 88 ^ptr{}; 89 free( ptr ); 90 } 91 } 92 80 93 //--------------------------------------- 81 94 … … 141 154 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} 142 155 return re + im * _Complex_I; 143 } 156 } 144 157 145 158 int strto( const char * sptr, char ** eptr, int base ) { … … 213 226 //--------------------------------------- 214 227 215 //forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )216 //[ T, T ] div( T t1, T t2 ) { return [ t1 / t2, t1 % t2 ]; }228 forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } ) 229 [ T, T ] div( T t1, T t2 ) { return [ t1 / t2, t1 % t2 ]; } 217 230 218 231 //---------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.