Changeset 5721a6d for src/libcfa
- Timestamp:
- Feb 1, 2016, 2:24:50 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 2a4b088, b4cd03b7
- Parents:
- ae8b942
- Location:
- src/libcfa
- Files:
-
- 5 edited
-
Makefile.am (modified) (2 diffs)
-
Makefile.in (modified) (1 diff)
-
algorithm (modified) (3 diffs)
-
algorithm.c (modified) (3 diffs)
-
iostream.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/Makefile.am
rae8b942 r5721a6d 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Fri Jan 29 11:39:09201614 ## Update Count : 1 0813 ## Last Modified On : Sat Jan 30 18:56:45 2016 14 ## Update Count : 110 15 15 ############################################################################### 16 16 … … 54 54 55 55 # extension-less header files are overridden by default make rules => explicitly override rule 56 % : %.c 56 % : %.c ${abs_top_srcdir}/src/driver/cfa-cpp 57 57 true 58 58 -
src/libcfa/Makefile.in
rae8b942 r5721a6d 585 585 586 586 # extension-less header files are overridden by default make rules => explicitly override rule 587 % : %.c 587 % : %.c ${abs_top_srcdir}/src/driver/cfa-cpp 588 588 true 589 589 -
src/libcfa/algorithm
rae8b942 r5721a6d 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 29 14:57:51 201613 // Update Count : 2 012 // Last Modified On : Mon Feb 1 13:41:51 2016 13 // Update Count : 26 14 14 // 15 16 //--------------------------------------- 15 17 16 18 forall( type T | { int ?<?( T, T ); } ) … … 19 21 forall( type T | { int ?>?( T, T ); } ) 20 22 T max( const T t1, const T t2 ); 23 24 //--------------------------------------- 25 26 forall( type T ) 27 void swap( T * t1, T * t2 ); 28 29 //--------------------------------------- 21 30 22 31 char abs( char ); … … 33 42 long double _Complex abs( long double _Complex ); 34 43 44 //--------------------------------------- 45 46 void randseed( long int s ); 47 char random(); 48 int random(); 49 unsigned int random(); 50 long int random(); 51 unsigned long int random(); 52 float random(); 53 double random(); 54 float _Complex random(); 55 double _Complex random(); 56 long double _Complex random(); 57 35 58 // Local Variables: // 36 59 // mode: c // -
src/libcfa/algorithm.c
rae8b942 r5721a6d 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 29 15:49:59201613 // Update Count : 2912 // Last Modified On : Mon Feb 1 13:42:05 2016 13 // Update Count : 52 14 14 // 15 15 … … 26 26 } // max 27 27 28 //--------------------------------------- 29 30 forall( type T ) 31 void swap( T * t1, T * t2 ) { 32 T temp = *t1; 33 *t1 = *t2; 34 *t2 = temp; 35 } // swap 36 37 //--------------------------------------- 28 38 29 39 extern "C" { 40 #define _XOPEN_SOURCE // required to access "rand48" routines 30 41 #include <stdlib.h> // abs, labs, llabs 31 42 #include <math.h> // fabsf, fabs, fabsl 32 43 #include <complex.h> // cabsf, cabs, cabsl 44 #undef I // free name 33 45 } // extern 34 46 … … 43 55 long double _Complex abs( long double _Complex v ) { return cabsl( v ); } 44 56 57 //--------------------------------------- 58 59 void randseed( long int s ) { srand48( s ); } 60 char random() { return lrand48(); } 61 int random() { return mrand48(); } 62 unsigned int random() { return lrand48(); } 63 long int random() { return mrand48(); } 64 unsigned long int random() { return lrand48(); } 65 float random() { return (float)drand48(); } // otherwise float uses lrand48 66 double random() { return drand48(); } 67 float _Complex random() { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); } 68 double _Complex random() { return drand48() + (double _Complex)(drand48() * _Complex_I); } 69 long double _Complex random() { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); } 45 70 46 71 // Local Variables: // -
src/libcfa/iostream.c
rae8b942 r5721a6d 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 29 15:38:34201613 // Update Count : 4712 // Last Modified On : Mon Feb 1 14:20:30 2016 13 // Update Count : 60 14 14 // 15 15 … … 83 83 forall( dtype ostype | ostream( ostype ) ) 84 84 ostype * ?|?( ostype *os, float _Complex c ) { 85 char buffer[64]; 86 return write( os, buffer, sprintf( buffer, "%g+i%g", crealf( c ), cimagf( c ) ) ); 85 return os | crealf( c ) | (cimagf( c ) < 0 ? "" : "+") | cimagf( c ) | 'i'; 87 86 } // ?|? 88 87 89 88 forall( dtype ostype | ostream( ostype ) ) 90 89 ostype * ?|?( ostype *os, double _Complex c ) { 91 char buffer[64]; 92 return write( os, buffer, sprintf( buffer, "%g+i%g", creal( c ), cimag( c ) ) ); 90 return os | creal( c ) | (cimag( c ) < 0 ? "" : "+") | cimag( c ) | 'i'; 93 91 } // ?|? 94 92 95 93 forall( dtype ostype | ostream( ostype ) ) 96 94 ostype * ?|?( ostype *os, long double _Complex c ) { 97 char buffer[64]; 98 return write( os, buffer, sprintf( buffer, "%Lg+i%Lg", creall( c ), cimagl( c ) ) ); 95 return os | creall( c ) | (cimagl( c ) < 0 ? "" : "+") | cimagl( c ) | 'i'; 99 96 } // ?|? 100 97
Note:
See TracChangeset
for help on using the changeset viewer.