diff options
| author | 2026-01-04 14:55:36 -0500 | |
|---|---|---|
| committer | 2026-01-04 14:55:40 -0500 | |
| commit | 06699c20fba983242e021f7b70452b1fe84c3ca1 (patch) | |
| tree | a113bd397c1d9a869cd615ab8236c9300def2cbe | |
| parent | 901ae51c1e0e2c2b5d92c55bf8740b32d4f96704 (diff) | |
cpu/e132xs: Simplify arithmetic right shift calculations
| -rw-r--r-- | src/devices/cpu/e132xs/e132xsop.hxx | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/devices/cpu/e132xs/e132xsop.hxx b/src/devices/cpu/e132xs/e132xsop.hxx index c570f9f5c6c..ca5c5f0ab3f 100644 --- a/src/devices/cpu/e132xs/e132xsop.hxx +++ b/src/devices/cpu/e132xs/e132xsop.hxx @@ -1265,11 +1265,7 @@ void hyperstone_device::hyperstone_sardi() { SR |= (val >> (n - 1)) & 1; - const uint64_t sign_bit = val >> 63; - val >>= n; - - if (sign_bit) - val |= 0xffffffff00000000U << (32 - n); + val = int64_t(val) >> n; } if (val == 0) @@ -1307,11 +1303,7 @@ void hyperstone_device::hyperstone_sard() { SR |= (val >> (n - 1)) & 1; - const uint64_t sign_bit = val >> 63; - val >>= n; - - if (sign_bit) - val |= 0xffffffff00000000L << (32 - n); + val = int64_t(val) >> n; } if (val == 0) @@ -1337,14 +1329,9 @@ void hyperstone_device::hyperstone_sar() if (n) { - const uint32_t sign_bit = ret & 0x80000000; - SR |= (ret >> (n - 1)) & 1; - ret >>= n; - - if (sign_bit) - ret |= 0xffffffff << (32 - n); + ret = int32_t(ret) >> n; } if (ret == 0) @@ -2063,14 +2050,9 @@ void hyperstone_device::hyperstone_sari() if (HiN || n) { - const uint32_t sign_bit = val & 0x80000000; - SR |= (val >> (n - 1)) & 1; - val >>= n; - - if (sign_bit) - val |= 0xffffffff << (32 - n); + val = int32_t(val) >> n; } if (val == 0) |
