Changeset 2162c2c for src/libcfa
- Timestamp:
- Jan 11, 2017, 4:11:02 PM (8 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:
- 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. - Location:
- src/libcfa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/math.c
rbb82c03 r2162c2c 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // math.c -- 8 // 6 // 7 // math.c -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Tue Apr 19 22:23:08 2016 … … 12 12 // Last Modified On : Sun Apr 24 08:52:31 2016 13 13 // Update Count : 75 14 // 14 // 15 15 16 16 #include "math" … … 34 34 long double remainder( long double x, long double y ) { return remainderl( x, y ); } 35 35 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 ]; } 37 37 float 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 ]; } 40 40 long double remquo( long double x, long double y, int *quo ) { return remquol( x, y, quo ); } 41 41 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 ]; } 43 43 float 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 ]; } 46 46 long double div( long double x, long double y, int *quo ) { return remquol( x, y, quo ); } 47 47 … … 278 278 long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); } 279 279 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 ]; } 281 281 float 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 ]; } 284 284 long double modf( long double x, long double *i ) { return modfl( x, i ); } 285 285 -
src/libcfa/stdlib
rbb82c03 r2162c2c 47 47 void free( void * ptr ); 48 48 } // extern "C" 49 50 forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p ); 51 forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr ); 52 49 53 50 54 //--------------------------------------- -
src/libcfa/stdlib.c
rbb82c03 r2162c2c 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.