mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-01-12 20:28:31 +00:00
[SPCA] more assembly
This commit is contained in:
8
semester3/spca/code-examples/01_asm/04_factorial.s
Normal file
8
semester3/spca/code-examples/01_asm/04_factorial.s
Normal file
@@ -0,0 +1,8 @@
|
||||
factorial:
|
||||
movl $1, %eax # Setup
|
||||
.AGAIN:
|
||||
imull %edi, %eax # %eax *= %edi
|
||||
subl $1, %edi # %edi--
|
||||
cmpl $1, %edi # 1 < %edi ?
|
||||
jg .AGAIN # go back, if yes
|
||||
ret
|
||||
Reference in New Issue
Block a user