diff --git a/lib/include/prjxray/memory_mapped_file.h b/lib/include/prjxray/memory_mapped_file.h index 6aeb8210..81f8dd72 100644 --- a/lib/include/prjxray/memory_mapped_file.h +++ b/lib/include/prjxray/memory_mapped_file.h @@ -12,6 +12,7 @@ #include #include +#include #include diff --git a/tools/bitread.cc b/tools/bitread.cc index 796b8c75..35ec139a 100644 --- a/tools/bitread.cc +++ b/tools/bitread.cc @@ -67,9 +67,9 @@ uint32_t frame_range_begin = 0, frame_range_end = 0; std::vector zero_frame(101); struct BitReader { - BitReader(const std::vector& bytes) : bytes_(bytes) {} + BitReader(const absl::Span& bytes) : bytes_(bytes) {} - const std::vector& bytes_; + const absl::Span& bytes_; template int operator()(T& arg) { @@ -319,7 +319,7 @@ int main(int argc, char** argv) { frame_range_end = strtol(p.second.c_str(), nullptr, 0) + 1; } - std::vector in_bytes; + absl::Span in_bytes; if (argc == 2) { auto in_file_name = argv[1]; auto in_file = @@ -333,16 +333,18 @@ int main(int argc, char** argv) { std::cout << "Bitstream size: " << in_file->size() << " bytes" << std::endl; - in_bytes = std::vector( - static_cast(in_file->data()), - static_cast(in_file->data()) + in_file->size()); + in_bytes = absl::Span( + static_cast(in_file->data()), in_file->size()); } else { + std::vector t; while (1) { int c = getchar(); if (c == EOF) break; - in_bytes.push_back(c); + t.push_back(c); } + in_bytes = absl::Span( + static_cast(t.data()), t.size()); std::cout << "Bitstream size: " << in_bytes.size() << " bytes" << std::endl;