summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@gmail.com>2010-12-28 20:27:52 -0800
committerTom Stellard <tstellar@gmail.com>2010-12-28 20:27:52 -0800
commit9e18507a1ee455bacb2a72bb8e641242f2ed5baf (patch)
tree4f1e53b30cd4f21ae3bd3618a84044030bd2f342
parent4f4f616a00c84867872e95720d4b5b0623062310 (diff)
instruction: Add trim_dst_regs()
-rw-r--r--instruction.cpp10
-rw-r--r--instruction.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/instruction.cpp b/instruction.cpp
index 8509eb6..1e7f91b 100644
--- a/instruction.cpp
+++ b/instruction.cpp
@@ -21,6 +21,16 @@ void instruction::add_src_reg(std::vector<register_address> src_reg)
m_src_regs.push_back(src_reg);
}
+void instruction::trim_dst_regs()
+{
+ unsigned int i;
+ for (i = 0; i < m_src_regs.size(); i++){
+ while (m_dst.size() > m_src_regs[i].size()) {
+ m_dst.pop_back();
+ }
+ }
+}
+
add_instruction::add_instruction(
std::vector<register_address> dst,
std::vector<register_address> src0,
diff --git a/instruction.h b/instruction.h
index 8e3a201..a41392b 100644
--- a/instruction.h
+++ b/instruction.h
@@ -19,6 +19,7 @@ public:
unsigned int src_reg_count);
virtual void execute(emulator & emulator) = 0;
virtual void add_src_reg(std::vector<register_address> src_reg);
+ virtual void trim_dst_regs();
protected:
const char * m_name;