tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fib.c (294B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 void swap(int* a, int* b) {
      5  int t = *a;
      6  *a = *b;
      7  *b = t;
      8 }
      9 
     10 int fib(int n) {
     11  int i, t, a = 0, b = 1;
     12  for (i = 0; i < n; i++) {
     13    a += b;
     14    swap(&a, &b);
     15  }
     16  return b;
     17 }