llvm.org GIT mirror llvm / ff4196a
Remove unnecessary conditional checks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185096 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 7 years ago
1 changed file(s) with 18 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
17811781 for (size_t I = 0, E = LHSNumParts; I < E; I+=2) {
17821782 std::pair LHSPart = LHSParts.getPart(I);
17831783 std::pair RHSPart = RHSParts.getPart(I);
1784 if ((I & 1) == 0) { // Expect even part to always be alpha.
1785 assert (LHSPart.first == false && RHSPart.first == false &&
1786 "Expected both parts to be alpha.");
1787 if (int Res = LHSPart.second.compare(RHSPart.second))
1788 return Res < 0;
1789 }
1784 // Expect even part to always be alpha.
1785 assert (LHSPart.first == false && RHSPart.first == false &&
1786 "Expected both parts to be alpha.");
1787 if (int Res = LHSPart.second.compare(RHSPart.second))
1788 return Res < 0;
17901789 }
17911790 for (size_t I = 1, E = LHSNumParts; I < E; I+=2) {
17921791 std::pair LHSPart = LHSParts.getPart(I);
17931792 std::pair RHSPart = RHSParts.getPart(I);
1794 if (I & 1) { // Expect odd part to always be numeric.
1795 assert (LHSPart.first == true && RHSPart.first == true &&
1796 "Expected both parts to be numeric.");
1797 if (LHSPart.second.size() != RHSPart.second.size())
1798 return LHSPart.second.size() < RHSPart.second.size();
1799
1800 unsigned LHSVal, RHSVal;
1801 if (LHSPart.second.getAsInteger(10, LHSVal))
1802 assert("Unable to convert LHS to integer.");
1803 if (RHSPart.second.getAsInteger(10, RHSVal))
1804 assert("Unable to convert RHS to integer.");
1805 if (LHSVal != RHSVal)
1806 return LHSVal < RHSVal;
1807 }
1793 // Expect odd part to always be numeric.
1794 assert (LHSPart.first == true && RHSPart.first == true &&
1795 "Expected both parts to be numeric.");
1796 if (LHSPart.second.size() != RHSPart.second.size())
1797 return LHSPart.second.size() < RHSPart.second.size();
1798
1799 unsigned LHSVal, RHSVal;
1800 if (LHSPart.second.getAsInteger(10, LHSVal))
1801 assert("Unable to convert LHS to integer.");
1802 if (RHSPart.second.getAsInteger(10, RHSVal))
1803 assert("Unable to convert RHS to integer.");
1804 if (LHSVal != RHSVal)
1805 return LHSVal < RHSVal;
18081806 }
18091807 return LHSNumParts < RHSNumParts;
18101808 }