[llvm] r245707 - [APFloat] Remove else after return and replace loop with std::equal. NFC.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 09:44:52 PDT 2015


Author: d0k
Date: Fri Aug 21 11:44:52 2015
New Revision: 245707

URL: http://llvm.org/viewvc/llvm-project?rev=245707&view=rev
Log:
[APFloat] Remove else after return and replace loop with std::equal. NFC.

Modified:
    llvm/trunk/lib/Support/APFloat.cpp

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=245707&r1=245706&r2=245707&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Fri Aug 21 11:44:52 2015
@@ -777,18 +777,12 @@ APFloat::bitwiseIsEqual(const APFloat &r
     return false;
   if (category==fcZero || category==fcInfinity)
     return true;
-  else if (isFiniteNonZero() && exponent!=rhs.exponent)
+
+  if (isFiniteNonZero() && exponent != rhs.exponent)
     return false;
-  else {
-    int i= partCount();
-    const integerPart* p=significandParts();
-    const integerPart* q=rhs.significandParts();
-    for (; i>0; i--, p++, q++) {
-      if (*p != *q)
-        return false;
-    }
-    return true;
-  }
+
+  return std::equal(significandParts(), significandParts() + partCount(),
+                    rhs.significandParts());
 }
 
 APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value) {




More information about the llvm-commits mailing list