Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/coding
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2017-07-07 13:08:23 +0300
committerYuri Gorshenin <y@maps.me>2017-07-07 16:18:19 +0300
commitebf89d7214f9e26bf73a90b17caa6487416eeec2 (patch)
tree9bba6bbc5bcd4fe019bffe16e85c63a3202c2cde /coding
parentde30819018ce5dfb962638a88e39133857398491 (diff)
Review fixes.
Diffstat (limited to 'coding')
-rw-r--r--coding/coding_tests/text_storage_tests.cpp3
-rw-r--r--coding/text_storage.hpp11
2 files changed, 9 insertions, 5 deletions
diff --git a/coding/coding_tests/text_storage_tests.cpp b/coding/coding_tests/text_storage_tests.cpp
index 8f9f86f343..ded2e8e206 100644
--- a/coding/coding_tests/text_storage_tests.cpp
+++ b/coding/coding_tests/text_storage_tests.cpp
@@ -86,7 +86,8 @@ UNIT_TEST(TextStorage_Simple)
UNIT_TEST(TextStorage_Empty)
{
vector<string> strings;
- for (int i = 0; i < 1000; ++i) {
+ for (int i = 0; i < 1000; ++i)
+ {
strings.emplace_back(string(1 /* size */, i % 256));
for (int j = 0; j < 1000; ++j)
strings.emplace_back();
diff --git a/coding/text_storage.hpp b/coding/text_storage.hpp
index 0f0c50b9d2..ac4f7065ce 100644
--- a/coding/text_storage.hpp
+++ b/coding/text_storage.hpp
@@ -14,14 +14,17 @@
namespace coding
{
-// Writes set of strings in a format that allows to access blocks of
-// strings. The size of each block roughly equals to the |blockSize|,
+// Writes a set of strings in a format that allows to efficiently
+// access blocks of strings. This means that access of individual
+// strings may be inefficient, but access to a block of strings can be
+// performed in O(length of all strings in the block + log(number of
+// blocks)). The size of each block roughly equals to the |blockSize|,
// because the whole number of strings is packed into a single block.
//
// Format description:
// * first 8 bytes - little endian-encoded offset of the index section
// * data section - represents a catenated sequence of BWT-compressed blocks with
-// the sequence of individual string lengths in the block
+// a sequence of individual string lengths in the block
// * index section - represents a delta-encoded sequence of
// BWT-compressed blocks offsets intermixed with the number of
// strings inside each block.
@@ -183,7 +186,7 @@ public:
auto const numBlocks = ReadVarUint<uint64_t, NonOwningReaderSource>(source);
m_blocks.assign(numBlocks, {});
- uint64_t prevOffset = 8; // 8 bytes for the offset
+ uint64_t prevOffset = 8; // 8 bytes for the offset of the data section
for (uint64_t i = 0; i < numBlocks; ++i)
{
auto const delta = ReadVarUint<uint64_t, NonOwningReaderSource>(source);