aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_machine')
-rw-r--r--qtmips_machine/alu.cpp4
-rw-r--r--qtmips_machine/instruction.cpp4
2 files changed, 3 insertions, 5 deletions
diff --git a/qtmips_machine/alu.cpp b/qtmips_machine/alu.cpp
index 8be9f2a..0350412 100644
--- a/qtmips_machine/alu.cpp
+++ b/qtmips_machine/alu.cpp
@@ -36,13 +36,13 @@ std::uint32_t alu_operate(enum AluOp operation, std::uint32_t s, std::uint32_t t
case ALU_OP_ADD:
if (s > (0xFFFFFFFF - t))
throw QTMIPS_EXCEPTION(Overflow, "ADD operation overflow/underflow", QString::number(s) + QString(" + ") + QString::number(t));
- // Intentional falltrough
+ __attribute__((fallthrough));
case ALU_OP_ADDU:
return s + t;
case ALU_OP_SUB:
if (s < t)
throw QTMIPS_EXCEPTION(Overflow, "SUB operation overflow/underflow", QString::number(s) + QString(" - ") + QString::number(t));
- // Intentional falltrough
+ __attribute__((fallthrough));
case ALU_OP_SUBU:
return s - t;
case ALU_OP_AND:
diff --git a/qtmips_machine/instruction.cpp b/qtmips_machine/instruction.cpp
index b6abebc..4137fdd 100644
--- a/qtmips_machine/instruction.cpp
+++ b/qtmips_machine/instruction.cpp
@@ -67,9 +67,7 @@ Instruction::Instruction(std::uint8_t opcode, std::uint32_t address) {
this->dt |= address;
}
-Instruction::Instruction(const Instruction &i) {
- this->dt = i.data();
-}
+Instruction::Instruction(const Instruction &i) : Instruction(i.data()) { }
QString Instruction::to_str() {
if (this->opcode() >= sizeof(instruction_map))