summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/devices/cpu/e132xs/e132xs.h4
-rw-r--r--src/devices/cpu/e132xs/e132xsop.hxx12
-rw-r--r--src/osd/eminline.h13
3 files changed, 10 insertions, 19 deletions
diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h
index 3c27a39d737..51f9c5cc3c1 100644
--- a/src/devices/cpu/e132xs/e132xs.h
+++ b/src/devices/cpu/e132xs/e132xs.h
@@ -337,6 +337,10 @@ private:
uint32_t get_global_register(uint8_t code);
+ // words interpreted as pairs of signed half-words (HS)
+ static int get_lhs(uint32_t val) { return int16_t(val & 0xffff); }
+ static int get_rhs(uint32_t val) { return int16_t(val >> 16); }
+
uint32_t get_emu_code_addr(uint8_t num);
int32_t get_instruction_length(uint16_t op);
diff --git a/src/devices/cpu/e132xs/e132xsop.hxx b/src/devices/cpu/e132xs/e132xsop.hxx
index 953e82f4150..03a35898a9d 100644
--- a/src/devices/cpu/e132xs/e132xsop.hxx
+++ b/src/devices/cpu/e132xs/e132xsop.hxx
@@ -2264,27 +2264,27 @@ void hyperstone_device::hyperstone_extend()
// signed half-word multiply/add, single word product sum
case EHMAC:
- m_core->global_regs[15] = (int32_t)m_core->global_regs[15] + mul_16x16(vald >> 16, vals >> 16) + mul_16x16(vald & 0xffff, vals & 0xffff);
+ m_core->global_regs[15] = m_core->global_regs[15] + get_lhs(vald) * get_lhs(vals) + get_rhs(vald) * get_rhs(vals);
break;
// signed half-word multiply/add, double word product sum
case EHMACD:
{
- int64_t result = get_double_word<GLOBAL>(14, 15) + (int64_t)mul_16x16(vald >> 16, vals >> 16) + (int64_t)mul_16x16(vald & 0xffff, vals & 0xffff);
+ int64_t result = get_double_word<GLOBAL>(14, 15) + int64_t(get_lhs(vald) * get_lhs(vals)) + int64_t(get_rhs(vald) * get_rhs(vals));
set_double_word<GLOBAL>(14, 15, result);
break;
}
// half-word complex multiply
case EHCMULD:
- m_core->global_regs[14] = mul_16x16(vald >> 16, vals >> 16 ) - mul_16x16(vald & 0xffff, vals & 0xffff);
- m_core->global_regs[15] = mul_16x16(vald >> 16, vals & 0xffff) + mul_16x16(vald & 0xffff, vals >> 16 );
+ m_core->global_regs[14] = get_lhs(vald) * get_lhs(vals) - get_rhs(vald) * get_rhs(vals);
+ m_core->global_regs[15] = get_lhs(vald) * get_rhs(vals) + get_rhs(vald) * get_lhs(vals);
break;
// half-word complex multiply/add
case EHCMACD:
- m_core->global_regs[14] += mul_16x16(vald >> 16, vals >> 16 ) - mul_16x16(vald & 0xffff, vals & 0xffff);
- m_core->global_regs[15] += mul_16x16(vald >> 16, vals & 0xffff) + mul_16x16(vald & 0xffff, vals >> 16 );
+ m_core->global_regs[14] += get_lhs(vald) * get_lhs(vals) - get_rhs(vald) * get_rhs(vals);
+ m_core->global_regs[15] += get_lhs(vald) * get_rhs(vals) + get_rhs(vald) * get_lhs(vals);
break;
// half-word (complex) add/subtract
diff --git a/src/osd/eminline.h b/src/osd/eminline.h
index 685025416b9..4d4ccb25237 100644
--- a/src/osd/eminline.h
+++ b/src/osd/eminline.h
@@ -51,19 +51,6 @@
***************************************************************************/
/*-------------------------------------------------
- mul_16x16 - perform a signed 16 bit x 16 bit
- multiply and return the full 32 bit result
--------------------------------------------------*/
-
-#ifndef mul_16x16
-constexpr int32_t mul_16x16(int16_t a, int16_t b)
-{
- return int32_t(a) * int32_t(b);
-}
-#endif
-
-
-/*-------------------------------------------------
mul_32x32 - perform a signed 32 bit x 32 bit
multiply and return the full 64 bit result
-------------------------------------------------*/