summaryrefslogtreecommitdiff
path: root/contrib/bug216610/c/fib.c
blob: bd665c7879fd0d3cb1b96ebab17f0aadbc50e8af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <inttypes.h>

struct state {
    uint32_t b, a;
};

void fib_init(struct state *s);
void fib_init(struct state *s)
{
    s->a = 0;
    s->b = 1;
}

void fib_next(struct state *s);
void fib_next(struct state *s)
{
    uint32_t next = s->a + s->b;
    s->a = s->b;
    s->b = next;
}