3 ms·
At first I thought the book was trolling me, but then I sat down and worked through a few of the pages on paper and realized that there were interesting tricks
by jensnockert 12y ago
At first I thought the book was trolling me, but then I sat down and worked through a few of the pages on paper and realized that there were interesting tricks behind them.
- jgeralnik 12y agoAgreed. The second snippet (http://www.xorpd.net/pages/xchg_rax/snip_01.html http://www.xorpd.net/pages/xchg_rax/snip_01.html) is relatively simple to understand and is now my favorite two opcode program.
- kaoD 12y agoIs this the Fibonacci sequence? EDIT: For anyone curious, being rax and rdx the starting terms, the rcx-th term is found in rax at the end of the loop.
- jgeralnik 12y agoYup. The xadd opcode adds the two registers together and swaps them so that the previous element is always in the same register.