mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 23:00:44 +02:00
Removes some undefined behaviour in the interpreter VExtr implementation
This commit is contained in:
1 parent
ddd7b8f406
commit
a11aed2f47
1 file changed
+8
-1
@@ -3788,7 +3788,14 @@ void InterpreterCore::ExecuteCode(FEXCore::Core::InternalThreadState *Thread) {
|
||||
__uint128_t Src2 = *GetSrc<__uint128_t*>(SSAData, Op->Header.Args[1]);
|
||||
|
||||
uint64_t Offset = Op->Index * Op->Header.ElementSize * 8;
|
||||
__uint128_t Dst = (Src1 << (sizeof(__uint128_t) * 8 - Offset)) | (Src2 >> Offset);
|
||||
__uint128_t Dst{};
|
||||
if (Offset >= (OpSize * 8)) {
|
||||
Offset -= OpSize * 8;
|
||||
Dst = Src1 >> Offset;
|
||||
}
|
||||
else {
|
||||
Dst = (Src1 << (OpSize * 8 - Offset)) | (Src2 >> Offset);
|
||||
}
|
||||
|
||||
memcpy(GDP, &Dst, OpSize);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user