summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-09-17 09:35:11 -0400
committerLioncash <mathew1800@gmail.com>2015-09-17 09:35:13 -0400
commitcfa43f64bf57f3afb2c07ed72d3b79f2326d877b (patch)
treef5279e2e2724b8a42c445b0e25d4a64bcb6e6df4 /Source/Core
parent7974b7074c3a77bd63b48ce6b0dbe937e57735ab (diff)
x64Emitter: Remove pointer cast
No more ubsan asserts in the JIT and x64 emitter code paths when running starfield.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/x64Emitter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/Core/Common/x64Emitter.cpp b/Source/Core/Common/x64Emitter.cpp
index f2763d83a8..6cc779b80a 100644
--- a/Source/Core/Common/x64Emitter.cpp
+++ b/Source/Core/Common/x64Emitter.cpp
@@ -494,7 +494,9 @@ void XEmitter::SetJumpTarget(const FixupBranch& branch)
{
s64 distance = (s64)(code - branch.ptr);
_assert_msg_(DYNA_REC, distance >= -0x80000000LL && distance < 0x80000000LL, "Jump target too far away, needs indirect register");
- ((s32*)branch.ptr)[-1] = (s32)distance;
+
+ s32 valid_distance = static_cast<s32>(distance);
+ std::memcpy(&branch.ptr[-4], &valid_distance, sizeof(s32));
}
}