mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-11-09 17:51:58 +00:00
refactor(zcg): use wordsize instead of architecture
This commit is contained in:
1 parent
abfc2dc547
commit
97591f59f4
30 files changed
+170
-173
No files matched your search
@@ -1,19 +0,0 @@
|
||||
#include "Architecture.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
unsigned GetPointerSizeForArchitecture(const Architecture architecture)
|
||||
{
|
||||
switch (architecture)
|
||||
{
|
||||
case Architecture::X86:
|
||||
return sizeof(uint32_t);
|
||||
|
||||
case Architecture::X64:
|
||||
return sizeof(uint64_t);
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
return sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class Architecture : std::uint8_t
|
||||
{
|
||||
UNKNOWN,
|
||||
X86,
|
||||
X64
|
||||
};
|
||||
|
||||
static constexpr Architecture OWN_ARCHITECTURE =
|
||||
#if defined(ARCH_x86)
|
||||
Architecture::X86
|
||||
#elif defined(ARCH_x64)
|
||||
Architecture::X64
|
||||
#endif
|
||||
;
|
||||
|
||||
extern unsigned GetPointerSizeForArchitecture(Architecture architecture);
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "WordSize.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
unsigned GetPointerSizeForWordSize(const WordSize wordSize)
|
||||
{
|
||||
switch (wordSize)
|
||||
{
|
||||
case WordSize::BITS_32:
|
||||
return sizeof(uint32_t);
|
||||
|
||||
case WordSize::BITS_64:
|
||||
return sizeof(uint64_t);
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
return sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class WordSize : std::uint8_t
|
||||
{
|
||||
UNKNOWN,
|
||||
BITS_32,
|
||||
BITS_64
|
||||
};
|
||||
|
||||
static constexpr WordSize OWN_WORD_SIZE =
|
||||
#if defined(ARCH_x86)
|
||||
WordSize::BITS_32
|
||||
#elif defined(ARCH_x64)
|
||||
WordSize::BITS_64
|
||||
#endif
|
||||
;
|
||||
|
||||
extern unsigned GetPointerSizeForWordSize(WordSize wordSize);
|
||||
Reference in new issue
Block a user