Update to DistinctIndices function (for issue #857).

Replaces pull request #974.
This commit is contained in:
Simon
2016-06-08 23:20:54 +08:00
parent 592b2f0e64
commit 574f0bca77

View File

@@ -12,18 +12,12 @@ bool DistinctIndices(const FullStepRow<WIDTH>& a, const FullStepRow<WIDTH>& b, s
{ {
std::vector<eh_index> aSrt = a.GetIndices(len, lenIndices); std::vector<eh_index> aSrt = a.GetIndices(len, lenIndices);
std::vector<eh_index> bSrt = b.GetIndices(len, lenIndices); std::vector<eh_index> bSrt = b.GetIndices(len, lenIndices);
for(auto const& value1: aSrt) {
std::sort(aSrt.begin(), aSrt.end()); for(auto const& value2: bSrt) {
std::sort(bSrt.begin(), bSrt.end()); if (value1==value2) {
return false;
unsigned int i = 0; }
for (unsigned int j = 0; j < bSrt.size(); j++) {
while (aSrt[i] < bSrt[j]) {
i++;
if (i == aSrt.size()) { return true; }
} }
assert(aSrt[i] >= bSrt[j]);
if (aSrt[i] == bSrt[j]) { return false; }
} }
return true; return true;
} }