diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-08-31 22:34:56 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-08-31 22:34:56 -0700 |
commit | 518429b1cbb193d31416e02e660908469b96a459 (patch) | |
tree | cd89135d66f07f49f6dbf3670dba214b66517855 /apps | |
parent | 5008a4ec4e21a73246b354758d6a68bb9b33f78f (diff) | |
download | mu-518429b1cbb193d31416e02e660908469b96a459.tar.gz |
5598
Diffstat (limited to 'apps')
-rw-r--r-- | apps/factorial.subx | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/apps/factorial.subx b/apps/factorial.subx index 34309546..12fc3b0c 100644 --- a/apps/factorial.subx +++ b/apps/factorial.subx @@ -73,9 +73,8 @@ factorial: # n : int -> int/eax 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp 53/push-ebx - # eax = 1 (base case) + # if (n <= 1) return 1 b8/copy-to-eax 1/imm32 - # if (n <= 1) return 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 1/imm32 # compare *(ebp+8) 7e/jump-if-<= $factorial:end/disp8 # ebx = n-1 |