diff --git a/src/frontend/A32/types.h b/src/frontend/A32/types.h index d6b36384..50a76ef8 100644 --- a/src/frontend/A32/types.h +++ b/src/frontend/A32/types.h @@ -92,16 +92,14 @@ inline size_t RegNumber(ExtReg reg) { } inline Reg operator+(Reg reg, size_t number) { - ASSERT(reg != Reg::INVALID_REG); - - size_t new_reg = static_cast(reg) + number; + const size_t new_reg = RegNumber(reg) + number; ASSERT(new_reg <= 15); return static_cast(new_reg); } inline ExtReg operator+(ExtReg reg, size_t number) { - ExtReg new_reg = static_cast(static_cast(reg) + number); + const auto new_reg = static_cast(static_cast(reg) + number); ASSERT((IsSingleExtReg(reg) && IsSingleExtReg(new_reg)) || (IsDoubleExtReg(reg) && IsDoubleExtReg(new_reg)));