| 82 | } |
| 83 | |
| 84 | std::optional<uint64_t> FindInFile( |
| 85 | const std::filesystem::path& path, |
| 86 | std::span<const uint8_t> pattern, |
| 87 | size_t chunkBytes) { |
| 88 | // A whole-file scan is just a range scan over [0, EOF). FindInFileRange clamps |
| 89 | // the requested size to the real file size, so a max sentinel means "to the end |
| 90 | // of the file" — this routes the legacy path through the same overlapped |
| 91 | // double-buffered engine (read of chunk i+1 overlaps the BMH scan of chunk i) |
| 92 | // and keeps a single I/O implementation. |
| 93 | return FindInFileRange( |
| 94 | path, 0, (std::numeric_limits<uint64_t>::max)(), pattern, chunkBytes); |
| 95 | } |
| 96 | |
| 97 | std::optional<uint64_t> FindInFileRange( |
| 98 | const std::filesystem::path& path, |
no test coverage detected