summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2022-09-20 22:33:45 -0400
committer AJR <ajrhacker@users.noreply.github.com>2022-09-20 22:33:45 -0400
commit87d91cba68a5ce3d41c4c618d641145298931326 (patch)
tree848dddd7e31c17d8f7268c7c3b69fdcc8c991d02 /src
parent00418d940659dd33bc57f5a6cb80b29973c992f9 (diff)
e132xs: Cleanups
- Use count_leading_zeros_32 instead of loop for TESTLZ - Simplify overflow mask calculation for SHL(I)
Diffstat (limited to 'src')
-rw-r--r--src/devices/cpu/e132xs/e132xsop.hxx13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/devices/cpu/e132xs/e132xsop.hxx b/src/devices/cpu/e132xs/e132xsop.hxx
index 0519eca538e..e99f86d3ec3 100644
--- a/src/devices/cpu/e132xs/e132xsop.hxx
+++ b/src/devices/cpu/e132xs/e132xsop.hxx
@@ -1466,7 +1466,7 @@ void hyperstone_device::hyperstone_shl()
uint32_t n = m_core->local_regs[src_code & 0x3f] & 0x1f;
uint32_t base = m_core->local_regs[dst_code & 0x3f]; /* registers offset by frame pointer */
- uint64_t mask = ((((uint64_t)1) << (32 - n)) - 1) ^ 0xffffffff;
+ uint32_t mask = n ? 0xffffffff << (32 - n) : 0;
SR &= ~(C_MASK | V_MASK | Z_MASK | N_MASK);
@@ -1491,14 +1491,7 @@ void hyperstone_device::hyperstone_testlz()
const uint32_t fp = GET_FP;
const uint32_t sreg = m_core->local_regs[(SRC_CODE + fp) & 0x3f];
- uint32_t zeros = 0;
- for (uint32_t mask = 0x80000000; mask != 0; mask >>= 1 )
- {
- if (sreg & mask)
- break;
- else
- zeros++;
- }
+ const uint32_t zeros = count_leading_zeros_32(sreg);
m_core->local_regs[(DST_CODE + fp) & 0x3f] = zeros;
@@ -2076,7 +2069,7 @@ void hyperstone_device::hyperstone_shli()
SR |= (val & (0x80000000 >> (n - 1))) ? 1 : 0;
}
- uint64_t mask = ((1U << (32 - n)) - 1) ^ 0xffffffff;
+ uint32_t mask = n ? 0xffffffff << (32 - n) : 0;
uint32_t val2 = val << n;
if (((val & mask) && (!(val2 & 0x80000000))) || (((val & mask) ^ mask) && (val2 & 0x80000000)))