aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-04-07 21:14:02 +0200
committerKarel Kočí <cynerd@email.cz>2018-04-07 21:14:02 +0200
commitd6600a85f4823b751c1dcca137a65d6a04e7c4ca (patch)
tree7123bf024f05ee9d2fb19a79cc633c6de6da5897 /qtmips_machine
parent8027941b705e219fd202b7c01d5a4a311670cbee (diff)
downloadqtmips-d6600a85f4823b751c1dcca137a65d6a04e7c4ca.tar.gz
qtmips-d6600a85f4823b751c1dcca137a65d6a04e7c4ca.tar.bz2
qtmips-d6600a85f4823b751c1dcca137a65d6a04e7c4ca.zip
Drop unneeded mask in memory implementation
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/memory.cpp4
1 files changed, 2 insertions, 2 deletions
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);
}