]> granicus.if.org Git - llvm/commitdiff
[APInt] Move operator=(uint64_t) inline as its pretty simple and is often used with...
authorCraig Topper <craig.topper@gmail.com>
Mon, 27 Mar 2017 20:07:31 +0000 (20:07 +0000)
committerCraig Topper <craig.topper@gmail.com>
Mon, 27 Mar 2017 20:07:31 +0000 (20:07 +0000)
While there recognize that we only need to clearUnusedBits on the single word case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298881 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APInt.h
lib/Support/APInt.cpp

index a29cfe5fbca8981ad8dd558a4ec923fe343b61cd..e527cebc057ceb9a594d7469d8b42fe8dd224d07 100644 (file)
@@ -676,7 +676,16 @@ public:
   /// than 64, the value is zero filled in the unspecified high order bits.
   ///
   /// \returns *this after assignment of RHS value.
-  APInt &operator=(uint64_t RHS);
+  APInt &operator=(uint64_t RHS) {
+    if (isSingleWord()) {
+      VAL = RHS;
+      clearUnusedBits();
+    } else {
+      pVal[0] = RHS;
+      memset(pVal+1, 0, (getNumWords() - 1) * APINT_WORD_SIZE);
+    }
+    return *this;
+  }
 
   /// \brief Bitwise AND assignment operator.
   ///
index ebcbb1518672005f938d112ddf4857ab26d08810..f2c3a2db30cb57dc1a44c0ac67e7065f83e1cdc7 100644 (file)
@@ -157,16 +157,6 @@ APInt& APInt::AssignSlowCase(const APInt& RHS) {
   return clearUnusedBits();
 }
 
-APInt& APInt::operator=(uint64_t RHS) {
-  if (isSingleWord())
-    VAL = RHS;
-  else {
-    pVal[0] = RHS;
-    memset(pVal+1, 0, (getNumWords() - 1) * APINT_WORD_SIZE);
-  }
-  return clearUnusedBits();
-}
-
 /// This method 'profiles' an APInt for use with FoldingSet.
 void APInt::Profile(FoldingSetNodeID& ID) const {
   ID.AddInteger(BitWidth);