Permalink
Browse files

Arm64Emitter: Get rid of a pointer cast within SetJumpTarget()

Type punning like this is undefined behavior. Instead, we use std::memcpy to
copy the necessary data over, which is well defined (as it treats both
the source and destination as unsigned char).
  • Loading branch information...
lioncash committed Aug 15, 2018
1 parent fb382e9 commit 67b015d76b704de4efa69d921559cc50b512fa25
Showing with 2 additions and 1 deletion.
  1. +2 −1 Source/Core/Common/Arm64Emitter.cpp
@@ -969,7 +969,8 @@ void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch)
inst = (0x25 << 26) | MaskImm26(distance);
break;
}
*(u32*)branch.ptr = inst;
std::memcpy(branch.ptr, &inst, sizeof(inst));
}
FixupBranch ARM64XEmitter::CBZ(ARM64Reg Rt)

0 comments on commit 67b015d

Please sign in to comment.