Simplify IsProbablyDuplicate()
This commit is contained in:
@@ -307,23 +307,21 @@ template<size_t MAX_INDICES>
|
|||||||
bool IsProbablyDuplicate(std::shared_ptr<eh_trunc> indices, size_t lenIndices)
|
bool IsProbablyDuplicate(std::shared_ptr<eh_trunc> indices, size_t lenIndices)
|
||||||
{
|
{
|
||||||
bool checked_index[MAX_INDICES] = {false};
|
bool checked_index[MAX_INDICES] = {false};
|
||||||
|
bool count_checked = 0;
|
||||||
for (int z = 0; z < lenIndices; z++) {
|
for (int z = 0; z < lenIndices; z++) {
|
||||||
|
// Skip over indices we have already paired
|
||||||
if (!checked_index[z]) {
|
if (!checked_index[z]) {
|
||||||
for (int y = z+1; y < lenIndices; y++) {
|
for (int y = z+1; y < lenIndices; y++) {
|
||||||
if (!checked_index[y] && indices.get()[z] == indices.get()[y]) {
|
if (!checked_index[y] && indices.get()[z] == indices.get()[y]) {
|
||||||
// Pair found
|
// Pair found
|
||||||
checked_index[y] = true;
|
checked_index[y] = true;
|
||||||
checked_index[z] = true;
|
count_checked += 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool is_probably_duplicate = true;
|
return count_checked == lenIndices;
|
||||||
for (int z = 0; z < lenIndices && is_probably_duplicate; z++) {
|
|
||||||
is_probably_duplicate &= checked_index[z];
|
|
||||||
}
|
|
||||||
return is_probably_duplicate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t WIDTH>
|
template<size_t WIDTH>
|
||||||
|
|||||||
Reference in New Issue
Block a user