From d6600a85f4823b751c1dcca137a65d6a04e7c4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 7 Apr 2018 21:14:02 +0200 Subject: Drop unneeded mask in memory implementation --- qtmips_machine/memory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qtmips_machine') diff --git a/qtmips_machine/memory.cpp b/qtmips_machine/memory.cpp index 040ea12..f22c5f2 100644 --- a/qtmips_machine/memory.cpp +++ b/qtmips_machine/memory.cpp @@ -17,7 +17,7 @@ void MemoryAccess::write_byte(std::uint32_t offset, std::uint8_t value) { } void MemoryAccess::write_hword(std::uint32_t offset, std::uint16_t value) { - int nth = SH_NTH_16(offset & ~0b1); + int nth = SH_NTH_16(offset); std::uint32_t mask = 0xffff << nth; // Mask for n-th half-word wword(offset, (rword(offset) & ~mask) | (((std::uint32_t)value << nth) & mask)); } @@ -32,7 +32,7 @@ std::uint8_t MemoryAccess::read_byte(std::uint32_t offset) const { } std::uint16_t MemoryAccess::read_hword(std::uint32_t offset) const { - int nth = SH_NTH_16(offset & ~0x1); + int nth = SH_NTH_16(offset); return (std::uint16_t)(rword(offset) >> nth); } -- cgit v1.2.3