generated from admin/template
Обновить works/SysProg/ПЗ_2/Readme.md
This commit is contained in:
@@ -36,6 +36,8 @@ Byte 0: 0xDD
|
|||||||
Byte 1: 0xCC
|
Byte 1: 0xCC
|
||||||
Byte 2: 0xBB
|
Byte 2: 0xBB
|
||||||
Byte 3: 0xAA
|
Byte 3: 0xAA
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
2.Посмотрите в ассемблер на то, как компилятор кладет 0xAABBCCDD в память.
|
2.Посмотрите в ассемблер на то, как компилятор кладет 0xAABBCCDD в память.
|
||||||
Найдите инструкцию mov DWORD PTR [rsp+...], 2864434397 (или в hex 0xaabbccdd ).
|
Найдите инструкцию mov DWORD PTR [rsp+...], 2864434397 (или в hex 0xaabbccdd ).
|
||||||
@@ -82,6 +84,7 @@ int main() {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|

|
||||||
Вопросы:
|
Вопросы:
|
||||||
|
|
||||||
Почему 127 + 1 даёт -128, а не ошибку?
|
Почему 127 + 1 даёт -128, а не ошибку?
|
||||||
@@ -255,13 +258,14 @@ int main() {
|
|||||||
Ответ:
|
Ответ:
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
//Создаем структуру из 3 полей (sign, exp, mantissa)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t mantissa : 23;
|
uint32_t mantissa : 23;
|
||||||
uint8_t exp : 8;
|
uint8_t exp : 8;
|
||||||
uint8_t sign : 1;
|
uint8_t sign : 1;
|
||||||
} FloatParts;
|
} FloatParts;
|
||||||
|
|
||||||
|
//Создаем функцию, которая собирает из них float через union.
|
||||||
typedef union {
|
typedef union {
|
||||||
float f_val;
|
float f_val;
|
||||||
uint32_t u_val;
|
uint32_t u_val;
|
||||||
|
|||||||
Reference in New Issue
Block a user