llvm.org GIT mirror llvm / 28ec1cc
[APInt] Move operator=(uint64_t) inline as its pretty simple and is often used with small constants that the compiler can optimize. 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 Craig Topper 3 years ago
2 changed file(s) with 10 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
675675 /// than 64, the value is zero filled in the unspecified high order bits.
676676 ///
677677 /// \returns *this after assignment of RHS value.
678 APInt &operator=(uint64_t RHS);
678 APInt &operator=(uint64_t RHS) {
679 if (isSingleWord()) {
680 VAL = RHS;
681 clearUnusedBits();
682 } else {
683 pVal[0] = RHS;
684 memset(pVal+1, 0, (getNumWords() - 1) * APINT_WORD_SIZE);
685 }
686 return *this;
687 }
679688
680689 /// \brief Bitwise AND assignment operator.
681690 ///
153153 memcpy(pVal, RHS.pVal, RHS.getNumWords() * APINT_WORD_SIZE);
154154 }
155155 BitWidth = RHS.BitWidth;
156 return clearUnusedBits();
157 }
158
159 APInt& APInt::operator=(uint64_t RHS) {
160 if (isSingleWord())
161 VAL = RHS;
162 else {
163 pVal[0] = RHS;
164 memset(pVal+1, 0, (getNumWords() - 1) * APINT_WORD_SIZE);
165 }
166156 return clearUnusedBits();
167157 }
168158