Updated day8 so it's not reliant on all op codes being 3 chars long
This commit is contained in:
parent
cf39fcda81
commit
de0da386ae
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue