diff --git a/src/assembler.cpp b/src/assembler.cpp index db7a0ce..1c5913f 100644 --- a/src/assembler.cpp +++ b/src/assembler.cpp @@ -21,8 +21,8 @@ std::string trim(const std::string& str, const std::string& character) { std::vector trim_lines(const std::vector& lines, const std::string& comment = ";") { std::vector result; for (std::string line : lines) { - int index = line.find(comment); - if (index != -1) { + size_t index = line.find(comment); + if (index != std::string::npos) { line = line.substr(0, index); } line = trim(line, " "); @@ -58,7 +58,7 @@ std::map create_labels_map(const std::vector continue; } std::shared_ptr instruction; - if (line.find('.') < 0) { + if (line.find('.') == std::string::npos) { instruction = Instruction::from_string(line); } else { std::string opstring = split_string(line)[0]; @@ -110,4 +110,4 @@ int main(int argc, char** argv) { std::vector binary = to_binary(parse_program(lines)); fileutils::write_bytes(binary, argv[2]); return 0; -} \ No newline at end of file +}