3 ms·
I think requiring the interpretation of fib to be recursive is a little biased toward stack-based language VMs. Non-recursive ARM (thumb) solution, 14 bytes:
by comex 16y ago
I think requiring the interpretation of fib to be recursive is a little biased toward stack-based language VMs.
Non-recursive ARM (thumb) solution, 14 bytes:
0: 2100 movs r1, #0
2: 3801 subs r0, #1
4: dd01 ble.n 0xa
6: 4401 add r1, r0
8: e7fb b.n 0x2
a: 4608 mov r0, r1
c: 4770 bx lr
- comex 16y agoSelf-reply: I'm an idiot, this just computes the sum of 1 to n. Doing fib requires a few more instructions.