mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-10-09 05:46:20 +02:00
[SPCA] more assembly
This commit is contained in:
1 parent
f0c472bb87
commit
42b7451241
6 files changed
+50
-1
No files matched your search
@@ -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
|
||||
@@ -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