Skip to content
Snippets Groups Projects
Unverified Commit ef8b9d44 authored by kaldoran's avatar kaldoran
Browse files

Add filter of duplicate value

parent 8f5737a2
Branches
Tags
No related merge requests found
...@@ -28,13 +28,13 @@ static std::string blobToString(const Blob &bl) { ...@@ -28,13 +28,13 @@ static std::string blobToString(const Blob &bl) {
std::string Prefix::toString() const { std::string Prefix::toString() const {
std::stringstream ss; std::stringstream ss;
ss << "Prefix : " << std::endl << "\tContent_ : "; ss << "Prefix : " << std::endl << "\tContent_ : \"";
ss << blobToString(content_); ss << blobToString(content_);
ss << std::endl; ss << "\"" << std::endl;
ss << "\tFlags_ : "; ss << "\tFlags_ : \"";
ss << blobToString(flags_); ss << blobToString(flags_);
ss << std::endl; ss << "\"" << std::endl;
return ss.str(); return ss.str();
} }
...@@ -193,6 +193,14 @@ void Pht::lookupStep(Prefix p, std::shared_ptr<int> lo, std::shared_ptr<int> hi, ...@@ -193,6 +193,14 @@ void Pht::lookupStep(Prefix p, std::shared_ptr<int> lo, std::shared_ptr<int> hi,
IndexEntry entry; IndexEntry entry;
entry.unpackValue(*value); entry.unpackValue(*value);
auto it = std::find_if(vals->cbegin(), vals->cend(), [&](const std::shared_ptr<IndexEntry>& ie) {
return ie->value == entry.value;
});
/* If we already got the value then get the next one */
if (it != vals->cend())
return true;
if (max_common_prefix_len) { /* inexact match case */ if (max_common_prefix_len) { /* inexact match case */
auto common_bits = Prefix::commonBits(p, entry.prefix); auto common_bits = Prefix::commonBits(p, entry.prefix);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment