summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-06-07 08:09:15 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-06-07 08:11:40 -0400
commit4da41acc0d457473945acea8e8247e6978bcf570 (patch)
treefe8f9eaf919960e489ddf7b109145a5b3a163e59
parent56c586514b35a077bc6c54008ed3cc43f4ff661e (diff)
m68kcpu: Alternate implementation suggested by Olivier Galibert (nw)
-rw-r--r--src/devices/cpu/m68000/m68kcpu.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp
index f8d0c087764..f5ebae8a803 100644
--- a/src/devices/cpu/m68000/m68kcpu.cpp
+++ b/src/devices/cpu/m68000/m68kcpu.cpp
@@ -1342,9 +1342,9 @@ void m68000_base_device::init16(address_space &space, address_space &ospace)
* 32-bit data memory interface
****************************************************************************/
-static inline u32 dword_from_byte(u8 data) { return u32(data) << 24 | u32(data) << 16 | u32(data) << 8 | data; }
-static inline u32 dword_from_word(u16 data) { return u32(data) << 16 | data; }
-static inline u32 dword_from_unaligned_word(u16 data) { return u32(data & 0xff00) << 16 | u32(data) << 8 | (data & 0xff00) >> 8; }
+static inline u32 dword_from_byte(u8 data) { return data * 0x01010101U; }
+static inline u32 dword_from_word(u16 data) { return data * 0x00010001U; }
+static inline u32 dword_from_unaligned_word(u16 data) { return u32(data) << 8 | ((data >> 8) * 0x01000001U); }
/* interface for 32-bit data bus (68EC020, 68020) */
void m68000_base_device::init32(address_space &space, address_space &ospace)
@@ -1376,7 +1376,7 @@ void m68000_base_device::init32(address_space &space, address_space &ospace)
case 3:
m_space->write_dword(address - 3, dword_from_unaligned_word(data), 0x000000ff);
- m_space->write_dword(address + 1, dword_from_byte(data & 0x00ff), 0xff000000);
+ m_space->write_dword(address + 1, dword_from_byte(data & 0x00ff), 0xff000000U);
break;
}
};