Update project

This commit is contained in:
328p
2026-09-29 18:51:25 +03:00
parent aead9e56dd
commit 7f9334d713
15 changed files with 78 additions and 42 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

-3
View File
@@ -1,3 +0,0 @@
int signed_divide(int a, int b) {
return a / b;
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 75 KiB

-3
View File
@@ -1,3 +0,0 @@
unsigned short swap_bytes(unsigned short n) {
return ((n & 0x1234) << 8) | ((n & 0x3412) >> 8);
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 96 KiB

-3
View File
@@ -1,3 +0,0 @@
long signed_divide(long s, long d) {
return s / d;
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 41 KiB

-10
View File
@@ -1,10 +0,0 @@
//потому что она аппаратно создана для вычисления адресов памяти в формате «База + Индекс × Масштаб + Смещение».
int mul3(int a) {
return a * 3;
}
int mul5(int a) {
return a * 5;
}
int mul9(int a) {
return a * 9;
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 127 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 52 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 102 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 104 KiB

-7
View File
@@ -1,7 +0,0 @@
unsigned long long factorial(int a) {
unsigned long long c = 2;
for (int i = 1; i <= a; ++i) {
c *= i;
}
return c;
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 106 KiB

+78 -16
View File
@@ -7,14 +7,32 @@
### Код на C ### Код на C
```c ```c
int signed_divide(int a, int b) { long sdiv_(long a, long b) {
return a / b; return a / b;
} }
unsigned long udiv_(unsigned long a, unsigned long b) {
return a / b;
}
int idiv32(int a, int b) {
return a / b;
}
long smod_(long a, long b) {
return a % b;
}
long divmod(long a, long b) {
return a / b + a % b;
}
``` ```
### Итог компиляции ### Итог компиляции
![solution Задание 1](1.png) ![solution Задание 1](1.png)
![solution Задание 1](1.1png)
Рисунок 1 – итог компиляции Рисунок 1 – итог компиляции
--- ---
@@ -26,8 +44,22 @@ int signed_divide(int a, int b) {
### Код на C ### Код на C
```c ```c
unsigned short swap_bytes(unsigned short n) { #include <stdint.h>
return ((n & 0x1234) << 8) | ((n & 0x3412) >> 8); uint16_t swap16(uint16_t x) {
return (x << 8) | (x >> 8);
}
uint32_t swap32(uint32_t x) {
return (x >> 24) | ((x >> 8) & 0xFF00) |
((x << 8) & 0xFF0000) | (x << 24);
}
uint32_t rotl3(uint32_t x) {
return (x << 3) | (x >> 29);
}
uint8_t swapnib(uint8_t x) {
return (x << 4) | (x >> 4);
} }
``` ```
@@ -45,8 +77,14 @@ unsigned short swap_bytes(unsigned short n) {
### Код на C ### Код на C
```c ```c
long signed_divide(long s, long d) { long sdiv_(long a, long b) {
return s / d; return a / b;
}
unsigned long udiv_(unsigned long a, unsigned long b) {
return a / b;
}
long smod_(long a, long b) {
return a % b;
} }
``` ```
@@ -65,9 +103,31 @@ long signed_divide(long s, long d) {
### Код на C ### Код на C
```c ```c
int mul3(int a) { return a * 3; } long m3(long a) {
int mul5(int a) { return a * 5; } return a * 3;
int mul9(int a) { return a * 9; } }
long m5(long a) {
return a * 5;
}
long m9(long a) {
return a * 9;
}
long m7(long a) {
return a * 7;
}
long m10(long a) {
return a * 10;
}
long m11(long a) {
return a * 11;
}
long m15(long a) {
return a * 15;
}
long m100(long a) {
return a * 100;
}
``` ```
### Итог компиляции ### Итог компиляции
@@ -87,20 +147,22 @@ int mul9(int a) { return a * 9; }
### Код на C ### Код на C
```c ```c
unsigned long long factorial(int a) { unsigned long fact(unsigned n) {
unsigned long long c = 2; unsigned long r = 1;
for (int i = 1; i <= a; ++i) { for (unsigned i = 2; i <= n; i++) r *= i;
c *= i; return r;
}
return c;
} }
``` ```
### Итоги компиляций ### Итоги компиляций
![solution Задание 5](5.png) ![solution Задание 5](5.png)
Рисунок 5 – итог компиляции -O0
![solution Задание 5](5.2.png) ![solution Задание 5](5.2.png)
Рисунок 5 – итог компиляции -O1
![solution Задание 5](5.3.png) ![solution Задание 5](5.3.png)
Рисунок 5 – итог компиляции -O2
![solution Задание 5](5.4.png) ![solution Задание 5](5.4.png)
Рисунок 5 – итог компиляции -O3
--- ---