frontend/A64/types: Use helper functions in operator+ overloads

Allows us to get rid of another explicit cast.
This commit is contained in:
Lioncash 2019-05-01 23:59:19 -04:00 committed by MerryMage
parent a1cace21a9
commit 0c43228ad5

View file

@ -57,14 +57,14 @@ inline size_t VecNumber(Vec vec) {
} }
inline Reg operator+(Reg reg, size_t number) { inline Reg operator+(Reg reg, size_t number) {
size_t new_reg = static_cast<size_t>(reg) + number; const size_t new_reg = RegNumber(reg) + number;
ASSERT(new_reg <= 31); ASSERT(new_reg <= 31);
return static_cast<Reg>(new_reg); return static_cast<Reg>(new_reg);
} }
inline Vec operator+(Vec vec, size_t number) { inline Vec operator+(Vec vec, size_t number) {
size_t new_vec = static_cast<size_t>(vec) + number; const size_t new_vec = VecNumber(vec) + number;
ASSERT(new_vec <= 31); ASSERT(new_vec <= 31);
return static_cast<Vec>(new_vec); return static_cast<Vec>(new_vec);