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:
9
semester3/spca/code-examples/01_asm/05_factorial.s
Normal file
9
semester3/spca/code-examples/01_asm/05_factorial.s
Normal file
@@ -0,0 +1,9 @@
|
||||
factorial:
|
||||
jmp .COMP # Check condition
|
||||
.LOOP:
|
||||
imull %edx, %eax # %eax *= %edx
|
||||
decl %edx # %edx--
|
||||
.COMP:
|
||||
cmpl $1, %edx # 1 < %edx ?
|
||||
jg .LOOP # if yes, go to loop
|
||||
ret
|
||||
Reference in New Issue
Block a user