Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/stdlib.c

    ra797e2b1 r627f585  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // algorithm.c -- 
     7// algorithm.c --
    88//
    99// Author           : Peter A. Buhr
     
    7878} // posix_memalign
    7979
     80forall( otype T, ttype Params | { void ?{}(T *, Params); } )
     81T * new( Params p ) {
     82        return ((T*)malloc()){ p };
     83}
     84
     85forall( dtype T | { void ^?{}(T *); } )
     86void delete( T * ptr ) {
     87  if ( ptr ) {
     88    ^ptr{};
     89    free( ptr );
     90  }
     91}
     92
    8093//---------------------------------------
    8194
     
    141154        if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {}
    142155        return re + im * _Complex_I;
    143 }       
     156}
    144157
    145158int strto( const char * sptr, char ** eptr, int base ) {
     
    213226//---------------------------------------
    214227
    215 // forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
    216 // [ T, T ] div( T t1, T t2 ) { return [ t1 / t2, t1 % t2 ]; }
     228forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
     229[ T, T ] div( T t1, T t2 ) { return [ t1 / t2, t1 % t2 ]; }
    217230
    218231//---------------------------------------
Note: See TracChangeset for help on using the changeset viewer.