[llvm] r302702 - [APInt] Use getRawData to slightly simplify some code.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 11:15:17 PDT 2017


Author: ctopper
Date: Wed May 10 13:15:17 2017
New Revision: 302702

URL: http://llvm.org/viewvc/llvm-project?rev=302702&view=rev
Log:
[APInt] Use getRawData to slightly simplify some code.

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

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=302702&r1=302701&r2=302702&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Wed May 10 13:15:17 2017
@@ -1431,7 +1431,7 @@ void APInt::divide(const APInt &LHS, uns
   // Initialize the dividend
   memset(U, 0, (m+n+1)*sizeof(unsigned));
   for (unsigned i = 0; i < lhsWords; ++i) {
-    uint64_t tmp = (LHS.getNumWords() == 1 ? LHS.U.VAL : LHS.U.pVal[i]);
+    uint64_t tmp = LHS.getRawData()[i];
     U[i * 2] = (unsigned)(tmp & mask);
     U[i * 2 + 1] = (unsigned)(tmp >> (sizeof(unsigned)*CHAR_BIT));
   }
@@ -1440,7 +1440,7 @@ void APInt::divide(const APInt &LHS, uns
   // Initialize the divisor
   memset(V, 0, (n)*sizeof(unsigned));
   for (unsigned i = 0; i < rhsWords; ++i) {
-    uint64_t tmp = (RHS.getNumWords() == 1 ? RHS.U.VAL : RHS.U.pVal[i]);
+    uint64_t tmp = RHS.getRawData()[i];
     V[i * 2] = (unsigned)(tmp & mask);
     V[i * 2 + 1] = (unsigned)(tmp >> (sizeof(unsigned)*CHAR_BIT));
   }




More information about the llvm-commits mailing list