Debian Codegraph @

contrib/bug216610/c/fib.c

raw
1 #include <inttypes.h>
2
3 struct state {
4 uint32_t b, a;
5 };
6
7 void fib_init(struct state *s);
8 void fib_init(struct state *s)
9 {
10 s->a = 0;
11 s->b = 1;
12 }
13
14 void fib_next(struct state *s);
15 void fib_next(struct state *s)
16 {
17 uint32_t next = s->a + s->b;
18 s->a = s->b;
19 s->b = next;
20 }