Changeset af1ed1ad
- Timestamp:
- Mar 23, 2018, 9:29:57 AM (7 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, with_gc
- Children:
- 2a84d06d, b5563e1
- Parents:
- 7e419e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/coroutine/fibonacci.c
r7e419e7 raf1ed1ad 10 10 // Created On : Thu Jun 8 07:29:37 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Dec 5 22:27:54 201713 // Update Count : 1 412 // Last Modified On : Thu Mar 22 22:45:44 2018 13 // Update Count : 15 14 14 // 15 15 … … 21 21 void ?{}( Fibonacci & fib ) with( fib ) { fn = 0; } 22 22 23 // main automatically called on first resume 23 24 void main( Fibonacci & fib ) with( fib ) { 24 25 int fn1, fn2; // retained between resumes 25 26 fn = 0; fn1 = fn; // 1st case 26 fn = 0; fn1 = fn; // 1st case 27 27 suspend(); // restart last resume 28 29 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 28 fn = 1; fn2 = fn1; fn1 = fn; // 2nd case 30 29 suspend(); // restart last resume 31 32 30 for ( ;; ) { 33 31 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; // general case
Note: See TracChangeset
for help on using the changeset viewer.