MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / readBoolVector

Function readBoolVector

include/storage/serialization.hpp:59–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58template <typename VectorT>
59void readBoolVector(tar::FileReader &reader, const std::string &name, VectorT &data)
60{
61 const auto count = reader.ReadElementCount64(name);
62 data.resize(count);
63 std::uint64_t index = 0;
64
65 using BlockType = std::uint64_t;
66 constexpr std::uint64_t BLOCK_BITS = CHAR_BIT * sizeof(BlockType);
67
68 const auto decode = [&](const BlockType block)
69 {
70 auto read_size = std::min<std::size_t>(count - index, BLOCK_BITS);
71 unpackBits<VectorT, BlockType>(data, index, read_size, block);
72 index += BLOCK_BITS;
73 };
74
75 reader.ReadStreaming<BlockType>(name, osrm::util::make_function_output_iterator(decode));
76}
77
78template <typename VectorT>
79void writeBoolVector(tar::FileWriter &writer, const std::string &name, const VectorT &data)

Callers 1

read<bool>Function · 0.85

Calls 3

ReadElementCount64Method · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected