Showing the changes to src/include/module_reader.h (1 of 40 files). Show all
Unified · Split
| @@ -0,0 +1,29 @@ | ||
| 1 | +// | |
| 2 | +// Dis VM | |
| 3 | +// File: module_reader.h | |
| 4 | +// Author: arr | |
| 5 | +// | |
| 6 | + | |
| 7 | +#ifndef _DISVM_SRC_INCLUDE_MODULE_READER_H_ | |
| 8 | +#define _DISVM_SRC_INCLUDE_MODULE_READER_H_ | |
| 9 | + | |
| 10 | +#include <cstdint> | |
| 11 | +#include "runtime.h" | |
| 12 | + | |
| 13 | +namespace disvm | |
| 14 | +{ | |
| 15 | + namespace format | |
| 16 | + { | |
| 17 | + using operand_t = int32_t; | |
| 18 | + static_assert(sizeof(operand_t) == sizeof(runtime::word_t), "Operand and word should be the same size"); | |
| 19 | + static_assert(sizeof(operand_t) == sizeof(runtime::vm_pc_t), "Operand and VM program counter type should be the same size"); | |
| 20 | + | |
| 21 | + struct magic_number_constants final | |
| 22 | + { | |
| 23 | + static const auto xmagic = operand_t{ 819248 }; // Normal module (0xC8030) | |
| 24 | + static const auto smagic = operand_t{ 923426 }; // Signed module (0xE1722) | |
| 25 | + }; | |
| 26 | + } | |
| 27 | +} | |
| 28 | + | |
| 29 | +#endif // _DISVM_SRC_INCLUDE_MODULE_READER_H_ | |