diff options
| author | Lioncash <mathew1800@gmail.com> | 2015-08-21 17:57:35 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2015-08-21 18:09:48 -0400 |
| commit | a69755d9ee4cd880c4993eaaee49ab0342202113 (patch) | |
| tree | 59eee95fb979df42cc579f3b7dbd6e03bfc58848 /Source/Core/Common/x64Emitter.cpp | |
| parent | 95d958c03df5ab46f6e47e224e4bf08b7f8c218a (diff) | |
x64Emitter: Remove pointer casts from Write{8,16,32,64} functions
This also silences quite a few ubsan asserts from firing when the emitter is being used.
Diffstat (limited to 'Source/Core/Common/x64Emitter.cpp')
| -rw-r--r-- | Source/Core/Common/x64Emitter.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/Core/Common/x64Emitter.cpp b/Source/Core/Common/x64Emitter.cpp index 839e350c16..fd9494f8b1 100644 --- a/Source/Core/Common/x64Emitter.cpp +++ b/Source/Core/Common/x64Emitter.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <cinttypes> +#include <cstring> #include "Common/CommonTypes.h" #include "Common/CPUDetect.h" @@ -91,6 +92,29 @@ u8* XEmitter::GetWritableCodePtr() return code; } +void XEmitter::Write8(u8 value) +{ + *code++ = value; +} + +void XEmitter::Write16(u16 value) +{ + std::memcpy(code, &value, sizeof(u16)); + code += sizeof(u16); +} + +void XEmitter::Write32(u32 value) +{ + std::memcpy(code, &value, sizeof(u32)); + code += sizeof(u32); +} + +void XEmitter::Write64(u64 value) +{ + std::memcpy(code, &value, sizeof(u64)); + code += sizeof(u64); +} + void XEmitter::ReserveCodeSpace(int bytes) { for (int i = 0; i < bytes; i++) |
