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).
This commit is contained in:
Lioncash 2018-08-14 23:45:42 -04:00
parent fb382e90eb
commit 67b015d76b

View file

@ -969,7 +969,8 @@ void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch)
inst = (0x25 << 26) | MaskImm26(distance); inst = (0x25 << 26) | MaskImm26(distance);
break; break;
} }
*(u32*)branch.ptr = inst;
std::memcpy(branch.ptr, &inst, sizeof(inst));
} }
FixupBranch ARM64XEmitter::CBZ(ARM64Reg Rt) FixupBranch ARM64XEmitter::CBZ(ARM64Reg Rt)