Changes in / [b3048d4:8aa474a]
- Location:
- src
- Files:
-
- 15 edited
-
libcfa/bits/defs.h (modified) (2 diffs)
-
libcfa/stdlib (modified) (3 diffs)
-
libcfa/stdlib.c (modified) (3 diffs)
-
tests/.expect/random.txt (modified) (1 diff)
-
tests/concurrent/examples/boundedBuffer.c (modified) (2 diffs)
-
tests/concurrent/examples/datingService.c (modified) (2 diffs)
-
tests/concurrent/signal/barge.c (modified) (1 diff)
-
tests/concurrent/signal/block.c (modified) (1 diff)
-
tests/concurrent/signal/disjoint.c (modified) (1 diff)
-
tests/concurrent/signal/wait.c (modified) (1 diff)
-
tests/concurrent/waitfor/recurse.c (modified) (1 diff)
-
tests/concurrent/waitfor/simple.c (modified) (1 diff)
-
tests/concurrent/waitfor/when.c (modified) (1 diff)
-
tests/coroutine/prodcons.c (modified) (2 diffs)
-
tests/random.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/bits/defs.h
rb3048d4 r8aa474a 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 // defs.h --8 // 6 // 7 // bits/defs.h -- 8 // 9 9 // Author : Thierry Delisle 10 // Created On : Thu Nov 9 13:24:10 201711 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Jan 2 09:17:06 201813 // Update Count : 214 // 10 // Created On : Thu Nov 09 13:24:10 2017 11 // Last Modified By : 12 // Last Modified On : 13 // Update Count : 14 // 15 15 16 16 #pragma once … … 20 20 #include <stdint.h> 21 21 22 #define likely(x) __builtin_expect(!!(x), 1)23 #define unlikely(x) __builtin_expect(!!(x), 0)22 #define unlikely(x) __builtin_expect(!!(x), 0) 23 #define likely (x) __builtin_expect(!!(x), 1) 24 24 #define thread_local _Thread_local 25 25 -
src/libcfa/stdlib
rb3048d4 r8aa474a 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:21:04201813 // Update Count : 29 212 // Last Modified On : Mon Jan 1 17:35:43 2018 13 // Update Count : 291 14 14 // 15 15 … … 265 265 //--------------------------------------- 266 266 267 extern "C" { void srandom( unsigned int seed ); } // override C version 267 void random_seed( long int s ); 268 268 char random( void ); 269 269 char random( char u ); … … 275 275 unsigned int random( unsigned int u ); 276 276 unsigned int random( unsigned int l, unsigned int u ); 277 extern "C" { long int random( void ); } // override C version277 extern "C" { long int random( void ); } 278 278 long int random( long int u ); 279 279 long int random( long int l, long int u ); -
src/libcfa/stdlib.c
rb3048d4 r8aa474a 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:20:32201813 // Update Count : 4 4112 // Last Modified On : Mon Jan 1 19:03:16 2018 13 // Update Count : 437 14 14 // 15 15 … … 257 257 //--------------------------------------- 258 258 259 extern "C" { void srandom( unsigned int seed ) { srand48( seed ); } } // override C version 259 void random_seed( long int s ) { srand48( s ); srandom( s ); } // call srandom to harmonize with C-lib random 260 260 char random( void ) { return (unsigned long int)random(); } 261 261 char random( char u ) { return random( (unsigned long int)u ); } … … 267 267 unsigned int random( unsigned int u ) { return random( (unsigned long int)u ); } 268 268 unsigned int random( unsigned int l, unsigned int u ) { return random( (unsigned long int)l, (unsigned long int)u ); } 269 extern "C" { long int random( void ) { return mrand48(); } } // override C version 269 //extern "C" { long int random() { return mrand48(); } } 270 270 long int random( long int u ) { if ( u < 0 ) return random( u, 0 ); else return random( 0, u ); } 271 271 long int random( long int l, long int u ) { assert( l < u ); return lrand48() % (u - l) + l; } -
src/tests/.expect/random.txt
rb3048d4 r8aa474a 2 2 = 3 3 V 4 -911259971 4 2005783408 5 2 5 6 6 6 -4 7 1232105397 8 0 9 18 10 -914096085 11 1 12 15 13 2077092859 14 1 15 11 16 0.677254 17 0.678106775246139 18 0.298107+0.951551i 19 0.724141628787955+0.18815430330314i 20 0.358747528448063235+0.27913860468074958i 7 861904956 8 7 9 10 10 630915564 11 8 12 5 13 697339851 14 5 15 19 16 0.61653 17 0.623932379138292 18 0.677254+0.678107i 19 0.298107334760999+0.951550630916653i 20 0.724141628787954517+0.188154303303139869i -
src/tests/concurrent/examples/boundedBuffer.c
rb3048d4 r8aa474a 8 8 // Created On : Mon Oct 30 12:45:13 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : T ue Jan 2 12:18:18 201811 // Update Count : 3 310 // Last Modified On : Thu Dec 14 21:28:52 2017 11 // Update Count : 32 12 12 // 13 13 … … 91 91 processor p; 92 92 93 // srandom( getpid() );94 srandom( 1003 );93 //random_seed( getpid() ); 94 random_seed( 1003 ); 95 95 96 96 for ( i = 0; i < Cons; i += 1 ) { // create consumers -
src/tests/concurrent/examples/datingService.c
rb3048d4 r8aa474a 8 8 // Created On : Mon Oct 30 12:56:20 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Tue Jan 2 12:19:01 201811 // Update Count : 2 210 // Last Modified On : Wed Dec 6 12:19:19 2017 11 // Update Count : 21 12 12 // 13 13 … … 91 91 Boy *boys[NoOfPairs]; 92 92 93 srandom( /*getpid()*/ 103 );93 random_seed( /*getpid()*/ 103 ); 94 94 95 95 for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) { -
src/tests/concurrent/signal/barge.c
rb3048d4 r8aa474a 109 109 110 110 int main(int argc, char* argv[]) { 111 srandom(0);111 random_seed(0); 112 112 processor p; 113 113 { -
src/tests/concurrent/signal/block.c
rb3048d4 r8aa474a 118 118 119 119 int main(int argc, char* argv[]) { 120 srandom( time( NULL ) );120 random_seed( time( NULL ) ); 121 121 done = false; 122 122 processor p; -
src/tests/concurrent/signal/disjoint.c
rb3048d4 r8aa474a 109 109 // Main loop 110 110 int main(int argc, char* argv[]) { 111 srandom( time( NULL ) );111 random_seed( time( NULL ) ); 112 112 all_done = false; 113 113 processor p; -
src/tests/concurrent/signal/wait.c
rb3048d4 r8aa474a 127 127 // Main 128 128 int main(int argc, char* argv[]) { 129 srandom( time( NULL ) );129 random_seed( time( NULL ) ); 130 130 waiter_left = 4; 131 131 processor p[2]; -
src/tests/concurrent/waitfor/recurse.c
rb3048d4 r8aa474a 131 131 132 132 int main() { 133 srandom( time(NULL) );133 random_seed( time(NULL) ); 134 134 sout | "Starting" | endl; 135 135 { -
src/tests/concurrent/waitfor/simple.c
rb3048d4 r8aa474a 74 74 int main(int argc, char* argv[]) { 75 75 done = false; 76 srandom( time( NULL ) );76 random_seed( time( NULL ) ); 77 77 printf("%p\n", &globalA); 78 78 sout | "Starting" | endl; -
src/tests/concurrent/waitfor/when.c
rb3048d4 r8aa474a 77 77 78 78 int main() { 79 srandom( time(NULL) );79 random_seed( time(NULL) ); 80 80 sout | "Starting" | endl; 81 81 { -
src/tests/coroutine/prodcons.c
rb3048d4 r8aa474a 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:17:01 201813 // Update Count : 4 712 // Last Modified On : Tue Dec 5 22:40:55 2017 13 // Update Count : 46 14 14 // 15 15 … … 90 90 Prod prod; 91 91 Cons cons = { prod }; 92 srandom( /* getpid() */ 103 );// fixed seed for testing92 random_seed( /* getpid() */ 103 ); // fixed seed for testing 93 93 start( prod, 5, cons ); 94 94 sout | "main stops" | endl; -
src/tests/random.c
rb3048d4 r8aa474a 10 10 // Created On : Tue Jul 5 21:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 2 12:19:34 201813 // Update Count : 1 912 // Last Modified On : Sun Dec 24 07:48:23 2017 13 // Update Count : 18 14 14 // 15 15 … … 19 19 20 20 int main() { 21 // srandom( getpid() ); // set random seed22 srandom( 1003 );// fixed seed for repeatable tests21 // random_seed( getpid() ); // set random seed 22 random_seed( 1003 ); // fixed seed for repeatable tests 23 23 24 24 // test polymorphic calls to random and stream
Note:
See TracChangeset
for help on using the changeset viewer.