Updated day8 so it's not reliant on all op codes being 3 chars long

This commit is contained in:
Gnarwhal 2020-12-08 10:08:19 -08:00
parent cf39fcda81
commit de0da386ae
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174

View file

@ -40,7 +40,7 @@ auto extract_op(const std::string & string) -> Op {
else if (string.substr(0, 3) == "jmp") { op.code = Jmp; } else if (string.substr(0, 3) == "jmp") { op.code = Jmp; }
else if (string.substr(0, 3) == "nop") { op.code = Nop; } else if (string.substr(0, 3) == "nop") { op.code = Nop; }
op.num = std::stoi(string.substr(4, string.size() - 4)); op.num = std::stoi(string.substr(string.find(" ") + 1, string.size() - 4));
return op; return op;
} }