3 ms·
The x86 example is particularly cute: xadd eax, edx loop -3 implements the Fibonacci series in two machine instructions (notice eax and edx have 514
by a1k0n 10y ago
The x86 example is particularly cute:
xadd eax, edx
loop -3
implements the Fibonacci series in two machine instructions (notice eax and edx have 514229, 832040 in them after you run the example, the 29th and 30th Fibonacci numbers). I first saw that in a book a friend got me for christmas; a hard copy of this site: https://www.xorpd.net/pages/xchg_rax/snip_00.html https://www.xorpd.net/pages/xchg_rax/snip_00.html
- AlexAltea 10y agoI'm glad someone caught the reference. Indeed, I took it from the [xchg rax,rax] book. Also, I have to apologize for the many bugs the demos have at the moment (annoying editor, missing features), I intended to post a Shown HN post at a later point in time. During the next days I will be taking care of these matters. By the way, these demos rely in Capstone.js/Keystone.js to assemble/disassemble machine code (if anyone is interested, similar demos can be found at https://phi.nz/ https://phi.nz/).