Re:Writing a self-modifying x86 factorial program
by FastEatSlow on Wednesday December 15, 2021 @05:50AM
(#29564216)
There was an edge case where when the input was 0x2, it returned 0x1, that was my quick way of handling that.
[ Parent
| on HN ]
Re:Writing a self-modifying x86 factorial program
by unnouinceput on Wednesday December 15, 2021 @10:56AM
(#29567730)
Let's see, step by step, if we put 2 in EAX what happens:
Init: EBX = 2; EAX = 2;
Loop: EBX = 1;//gets decremented
CMP EBX, 1;//it's 1 so we exit
Final result is 2. Sounds the edge case is not that of an edge after all