Changeset 5721a6d for src/libcfa/algorithm.c
- Timestamp:
- Feb 1, 2016, 2:24:50 PM (8 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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: //
Note: See TracChangeset
for help on using the changeset viewer.