Changeset 2162c2c for src/libcfa


Ignore:
Timestamp:
Jan 11, 2017, 4:11:02 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
075734f
Parents:
bb82c03 (diff), d3a85240 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/libcfa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/math.c

    rbb82c03 r2162c2c  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // math.c -- 
    8 // 
     6//
     7// math.c --
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Tue Apr 19 22:23:08 2016
     
    1212// Last Modified On : Sun Apr 24 08:52:31 2016
    1313// Update Count     : 75
    14 // 
     14//
    1515
    1616#include "math"
     
    3434long double remainder( long double x, long double y ) { return remainderl( x, y ); }
    3535
    36 // [ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
     36[ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
    3737float remquo( float x, float y, int *quo ) { return remquof( x, y, quo ); }
    38 // [ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
    39 // [ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
     38[ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
     39[ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
    4040long double remquo( long double x, long double y, int *quo ) { return remquol( x, y, quo ); }
    4141
    42 // [ int, float ] div( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
     42[ int, float ] div( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
    4343float div( float x, float y, int *quo ) { return remquof( x, y, quo ); }
    44 // [ int, double ] div( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
    45 // [ int, long double ] div( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
     44[ int, double ] div( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
     45[ int, long double ] div( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
    4646long double div( long double x, long double y, int *quo ) { return remquol( x, y, quo ); }
    4747
     
    278278long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); }
    279279
    280 // [ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; }
     280[ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; }
    281281float modf( float x, float *i ) { return modff( x, i ); }
    282 // [ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; }
    283 // [ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; }
     282[ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; }
     283[ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; }
    284284long double modf( long double x, long double *i ) { return modfl( x, i ); }
    285285
  • src/libcfa/stdlib

    rbb82c03 r2162c2c  
    4747void free( void * ptr );
    4848} // extern "C"
     49
     50forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p );
     51forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
     52
    4953
    5054//---------------------------------------
  • src/libcfa/stdlib.c

    rbb82c03 r2162c2c  
    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.