| 89 | } |
| 90 | |
| 91 | bool compare_files(const std::filesystem::path& file1_path, const std::filesystem::path& file2_path) { |
| 92 | static std::vector<char> file1_buf(65536); |
| 93 | static std::vector<char> file2_buf(65536); |
| 94 | |
| 95 | std::ifstream file1(file1_path, std::ifstream::ate | std::ifstream::binary); //open file at the end |
| 96 | std::ifstream file2(file2_path, std::ifstream::ate | std::ifstream::binary); //open file at the end |
| 97 | const std::ifstream::pos_type fileSize = file1.tellg(); |
| 98 | |
| 99 | file1.rdbuf()->pubsetbuf(file1_buf.data(), file1_buf.size()); |
| 100 | file2.rdbuf()->pubsetbuf(file2_buf.data(), file2_buf.size()); |
| 101 | |
| 102 | if (fileSize != file2.tellg()) { |
| 103 | return false; //different file size |
| 104 | } |
| 105 | |
| 106 | file1.seekg(0); //rewind |
| 107 | file2.seekg(0); //rewind |
| 108 | |
| 109 | std::istreambuf_iterator<char> begin1(file1); |
| 110 | std::istreambuf_iterator<char> begin2(file2); |
| 111 | |
| 112 | return std::equal(begin1, std::istreambuf_iterator<char>(), begin2); //Second argument is end-of-range iterator |
| 113 | } |
| 114 | |
| 115 | bool recompile_single_function(const N64Recomp::Context& context, size_t func_index, const std::string& recomp_include, const std::filesystem::path& output_path, std::span<std::vector<uint32_t>> static_funcs_out) { |
| 116 | // Open the temporary output file |
no outgoing calls
no test coverage detected