Обновить lad1/README.md

This commit is contained in:
2026-09-29 10:09:25 +00:00
parent 7634aa10b8
commit 73fb7e41c9
+19 -5
View File
@@ -94,7 +94,9 @@ base + index × scale + displacement
Умножение на 3 Умножение на 3
long mul3(long x) { long mul3(long x)
{
return x * 3; return x * 3;
} }
@@ -112,7 +114,9 @@ rax = rdi + rdi × 2
Умножение на 5 Умножение на 5
long mul5(long x) { long mul5(long x)
{
return x * 5; return x * 5;
@@ -127,11 +131,17 @@ x + 4x = 5x
Умножение на 9 Умножение на 9
long mul9(long x) { long mul9(long x)
{
return x * 9; return x * 9;
} }
lea rax, [rdi + rdi*8] lea rax, [rdi + rdi*8]
ret ret
То есть: То есть:
@@ -162,10 +172,14 @@ lea rax, [rdi - 8]
Используем функцию факториала: Используем функцию факториала:
long factorial(int n) { long factorial(int n)
{
long result = 1; long result = 1;
for (int i = 2; i <= n; i++) { for (int i = 2; i <= n; i++)
{
result *= i; result *= i;
} }