Changeset 5416b44 for tests/nested_function.cfa
- Timestamp:
- May 27, 2022, 11:22:23 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 0a004b7
- Parents:
- c3b9d639
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/nested_function.cfa
rc3b9d639 r5416b44 1 //2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // nested_function.cfa -- Test nested functions run on user-thread stacks.8 //9 // Author : Peter A. Buhr10 // Created On : Mon May 23 22:21:30 202211 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon May 23 23:11:25 202213 // Update Count : 414 //15 16 1 #include <thread.hfa> 17 2 #include <fstream.hfa> 18 3 #include <stdlib.hfa> 19 4 20 thread T {}; 5 enum { VALUES = 10_000 }; 6 int values[VALUES], total = 0; 21 7 22 enum { VALUES = 10_000 }; 23 int values[VALUES]; 8 thread T { int id; }; 24 9 25 10 void main( T & ) { 11 int sum = 0; 26 12 void f() { 27 13 int i = 0; … … 36 22 else h(); 37 23 i += 1; 38 s out | "j" | j | bsearchl( j, values, VALUES );// has internal nested compare routine24 sum += bsearchl( j, values, VALUES ); // has internal nested compare routine 39 25 } // h 40 26 h(); 41 sout | "i" | i | bsearchl( i, values, VALUES ); // has internal nested compare routine42 27 } // f 43 28 f(); 29 __atomic_fetch_add( &total, sum, __ATOMIC_SEQ_CST ); 44 30 } 45 31 int main() { 46 32 set_seed( 1003 ); 47 33 for ( i; VALUES ) values[i] = i; 48 T t[5]; 34 { 35 T t[5]; 36 } 37 sout | "total" | total; 49 38 }
Note: See TracChangeset
for help on using the changeset viewer.