Merge pull request #2890 from lioncash/ptr
x64Emitter: Remove pointer casts from Write{8,16,32,64} functions
This commit is contained in:
commit
3f5ff98c1b
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/CPUDetect.h"
|
#include "Common/CPUDetect.h"
|
||||||
|
@ -91,6 +92,29 @@ u8* XEmitter::GetWritableCodePtr()
|
||||||
return code;
|
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)
|
void XEmitter::ReserveCodeSpace(int bytes)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bytes; i++)
|
for (int i = 0; i < bytes; i++)
|
||||||
|
|
|
@ -309,10 +309,10 @@ private:
|
||||||
void ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, size_t* shadowp, size_t* subtractionp, size_t* xmm_offsetp);
|
void ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, size_t* shadowp, size_t* subtractionp, size_t* xmm_offsetp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void Write8(u8 value) {*code++ = value;}
|
void Write8(u8 value);
|
||||||
inline void Write16(u16 value) {*(u16*)code = (value); code += 2;}
|
void Write16(u16 value);
|
||||||
inline void Write32(u32 value) {*(u32*)code = (value); code += 4;}
|
void Write32(u32 value);
|
||||||
inline void Write64(u64 value) {*(u64*)code = (value); code += 8;}
|
void Write64(u64 value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XEmitter() { code = nullptr; flags_locked = false; }
|
XEmitter() { code = nullptr; flags_locked = false; }
|
||||||
|
|
Loading…
Reference in New Issue