diff options
author | Hari Khalsa <hkhalsa@10gen.com> | 2013-10-15 11:41:15 -0400 |
---|---|---|
committer | Hari Khalsa <hkhalsa@10gen.com> | 2013-10-15 14:25:46 -0400 |
commit | 1364fd2651d68469e2793266c9ce4ba2bba983a9 (patch) | |
tree | c9c6d515f13c3b1337b0a52c78705082b3cf1d91 | |
parent | 038338603c41475f97b5919e3f6365f6163f12c5 (diff) | |
download | mongo-1364fd2651d68469e2793266c9ce4ba2bba983a9.tar.gz |
SERVER-10026 clean up logic for interval sorting comparison
-rw-r--r-- | src/mongo/db/query/index_bounds_builder.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp index f21aca3e1bf..dcef6ab890d 100644 --- a/src/mongo/db/query/index_bounds_builder.cpp +++ b/src/mongo/db/query/index_bounds_builder.cpp @@ -166,18 +166,13 @@ namespace mongo { if (0 != wo) { return wo < 0; } - if (lhs.startInclusive && rhs.startInclusive) { return false; } - // The start and end are equal. Put the bound that's inclusive to the left. - if (lhs.startInclusive) { - return true; - } - if (rhs.startInclusive) { - return false; - } - // If neither start nor end is inclusive but they begin at the same point who cares which is - // first. Strict weak requires irreflexivity requires false for equivalence. - return false; + // The start and end are equal. + // Strict weak requires irreflexivity which implies that equivalence returns false. + if (lhs.startInclusive == rhs.startInclusive) { return false; } + + // Put the bound that's inclusive to the left. + return lhs.startInclusive; } // static |