diff options
author | Karel Kočí <cynerd@email.cz> | 2017-12-21 14:59:09 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-12-21 14:59:09 +0100 |
commit | f1c0203237b976c366bedd950a2e6ffbcb8f7bcd (patch) | |
tree | 263a80f63f3b5056e5997edaf8ac694a73927e5c /qtmips_machine/registers.cpp | |
parent | 5715b6b916a5049b2f5542c022a41f895b9572a4 (diff) | |
download | qtmips-f1c0203237b976c366bedd950a2e6ffbcb8f7bcd.tar.gz qtmips-f1c0203237b976c366bedd950a2e6ffbcb8f7bcd.tar.bz2 qtmips-f1c0203237b976c366bedd950a2e6ffbcb8f7bcd.zip |
Some pleanups and small fixes
These are just code fixes. Shouldn't change anything but makes code
cleaner.
Diffstat (limited to 'qtmips_machine/registers.cpp')
-rw-r--r-- | qtmips_machine/registers.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/qtmips_machine/registers.cpp b/qtmips_machine/registers.cpp index f8961e1..447fdfc 100644 --- a/qtmips_machine/registers.cpp +++ b/qtmips_machine/registers.cpp @@ -18,7 +18,7 @@ Registers::Registers() : QObject() { Registers::Registers(const Registers &orig) : QObject() { this->pc = orig.read_pc(); - for (int i = 0; i < 31; i++) + for (std::uint8_t i = 0; i < 31; i++) this->gp[i] = orig.read_gp(i + 1); this->lo = orig.read_hi_lo(false); this->hi = orig.read_hi_lo(true); @@ -68,25 +68,25 @@ void Registers::write_gp(std::uint8_t i, std::uint32_t value) { this->gp[i - 1] = value; } -std::uint32_t Registers::read_hi_lo(bool hi) const { - if (hi) - return this->hi; +std::uint32_t Registers::read_hi_lo(bool is_hi) const { + if (is_hi) + return hi; else - return this->lo; + return lo; } -void Registers::write_hi_lo(bool hi, std::uint32_t value) { - if (hi) - this->hi = value; +void Registers::write_hi_lo(bool is_hi, std::uint32_t value) { + if (is_hi) + hi = value; else - this->lo = value; - emit hi_lo_update(hi, value); + lo = value; + emit hi_lo_update(is_hi, value); } bool Registers::operator==(const Registers &c) const { if (read_pc() != c.read_pc()) return false; - for (int i = 0; i < 31; i++) + for (std::uint8_t i = 0; i < 31; i++) if (read_gp(i) != c.read_gp(i)) return false; if (read_hi_lo(false) != c.read_hi_lo(false)) |