summaryrefslogtreecommitdiff
path: root/c/bigfib/bigfib.c
blob: 063c27ed6c1f34c2335f9d111c51ec891fb9030c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Fibonacci Sequence for RVController
 * A product of Advanced Mesecons Devices, a Cheapie Systems company
 * This is free and unencumbered software released into the public domain.
 * See http://unlicense.org/ for more information */

#include <stdint.h>
#include "rvcontroller-ecalls.h"

uint64_t prev = 0;
uint64_t oldprev = 0;
uint64_t curr = 1;

void main(void) {
	while ((curr & 0x800000000000000) == 0 ) {
		printstr("\nH ");
		printint(curr/(1LL << 32));
		printstr("\nL ");
		printint(curr%(1LL << 32));
		oldprev = prev;
		prev = curr;
		curr = prev + oldprev;
	}
}