summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/wasm-sourcemaps/fib.c
blob: 19afc33c6076a36050985f4d45f826f561a1c0c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

void swap(int* a, int* b) {
  int t = *a;
  *a = *b;
  *b = t;
}

int fib(int n) {
  int i, t, a = 0, b = 1;
  for (i = 0; i < n; i++) {
    a += b;
    swap(&a, &b);
  }
  return b;
}