mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-02-24 08:02:58 +00:00
u128: StickyLogicalShiftRight requires special-casing for amount == 64
In this case (128 - amount) == 64, and this invokes undefined behaviour
This commit is contained in:
@@ -112,6 +112,16 @@ u128 StickyLogicalShiftRight(u128 operand, int amount) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (amount == 64) {
|
||||
u128 result;
|
||||
result.lower = operand.upper;
|
||||
// Sticky bit
|
||||
if (operand.lower != 0) {
|
||||
result.lower |= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (amount < 128) {
|
||||
u128 result;
|
||||
result.lower = operand.upper >> (amount - 64);
|
||||
|
||||
Reference in New Issue
Block a user