Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Pardon, but the assembly code on the "Loop de Loop" chapter currently seems broken. "rax" is acting as all three variables somehow.


Nice catch! Just to be clear, it was that we were incrementing our exponent but not our counter, is that right? I pushed up a fix, but let me know if there were other issues.


It's a bit more involved than that.

  mul rcx, rax       ; multiply our result by our base, save into rcx
This should probably be using rbx, since that's the designated base, not rax, which is the exponent.

In the explanation just above, there's a 2*8 step missing, while this one is incorrect:

  4. result = 16 * 2, result is now 16
Since 2*16 is not 16.


Ahhhhh thank you! Do you mind opening a PR or issue so I can get to that? Thank you for noticing!!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: