This commit is contained in:
folkert van heusden 2024-04-22 14:08:13 +02:00
parent 423a2cd434
commit f0bb29fed3
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -832,8 +832,9 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
} }
else { else {
int shift_n = 64 - shift; int shift_n = 64 - shift;
uint16_t new_value = (uint64_t(0xffffffff0000) | R) >> (shift_n - 1); uint16_t new_value = (sign ? uint64_t(0xffffffff0000) : 0) | R;
new_value >>= shift_n - 1;
setPSW_c(new_value & 1); setPSW_c(new_value & 1);
new_value >>= 1; new_value >>= 1;
@ -881,8 +882,7 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
int shift_n = (64 - shift) - 1; int shift_n = (64 - shift) - 1;
// extend sign-bit // extend sign-bit
if (sign) // convert to unsigned 64b int & extend sign if (sign) { // convert to unsigned 64b int & extend sign
{
R0R1 = (uint64_t(R0R1) | 0xffffffff00000000ll) >> shift_n; R0R1 = (uint64_t(R0R1) | 0xffffffff00000000ll) >> shift_n;
setPSW_c(R0R1 & 1); setPSW_c(R0R1 & 1);