Ignore:
Timestamp:
Feb 27, 2020, 11:51:04 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
331eacbe, 37cdd97
Parents:
c886f4b (diff), 930b504 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/examples/Fib2.c

    rc886f4b r5452673  
    11#include <stdio.h>
    22
    3 void mary() {
    4         printf( "MARY\n" );
    5 }
    6 
    73#define FIB_INIT { 0 }
    8 typedef struct { int next; int fn1, fn2; } Fib;
     4typedef struct { int restart; int fn1, fn2; } Fib;
    95int fib( Fib * f ) {
    10         static void * states[] = { &&s1, &&s2, &&s3 };
    11         goto *states[f->next];
     6        static void * states[] = { &&s0, &&s1, &&s2 };
     7        goto *states[f->restart];
     8  s0:
     9        f->fn1 = 0;
     10        f->restart = 1;
     11        return f->fn1;
    1212  s1:
    13         mary();
    14         f->fn1 = 0;
    15         f->next = 1;
    16         return f->fn1;
    17   s2:
    18         mary();
    1913        f->fn2 = f->fn1;
    2014        f->fn1 = 1;
    21         f->next = 2;
     15        f->restart = 2;
    2216        return f->fn1;
    23   s3:;
    24         mary();
     17  s2:;
    2518        int fn = f->fn1 + f->fn2;
    2619        f->fn2 = f->fn1;
Note: See TracChangeset for help on using the changeset viewer.