registry bound check
This commit is contained in:
@@ -106,7 +106,10 @@ std::uint32_t Assembleur::ParseIO(Instruction a_Instruction, std::uint32_t a_R1,
|
|||||||
static std::uint32_t ParseRegistry(const std::string& a_Str) {
|
static std::uint32_t ParseRegistry(const std::string& a_Str) {
|
||||||
if (a_Str.at(0) != 'R')
|
if (a_Str.at(0) != 'R')
|
||||||
throw std::runtime_error("Registry " + a_Str + " not found !");
|
throw std::runtime_error("Registry " + a_Str + " not found !");
|
||||||
return std::stoi(a_Str.substr(1));
|
std::uint32_t registry = std::stoi(a_Str.substr(1));
|
||||||
|
if (registry > 7)
|
||||||
|
throw std::runtime_error("You can only have up to 8 registries !");
|
||||||
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsConstant(const std::string& a_Str) {
|
static bool IsConstant(const std::string& a_Str) {
|
||||||
|
|||||||
Reference in New Issue
Block a user