mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
Add APInt(numBits, ArrayRef<uint64_t> bigVal) constructor to prevent future ambiguity
errors like the one corrected by r135261. Migrate all LLVM callers of the old constructor to the new one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
+14
-6
@@ -83,25 +83,33 @@ void APInt::initSlowCase(const APInt& that) {
|
||||
memcpy(pVal, that.pVal, getNumWords() * APINT_WORD_SIZE);
|
||||
}
|
||||
|
||||
|
||||
APInt::APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[])
|
||||
: BitWidth(numBits), VAL(0) {
|
||||
void APInt::initFromArray(ArrayRef<uint64_t> bigVal) {
|
||||
assert(BitWidth && "Bitwidth too small");
|
||||
assert(bigVal && "Null pointer detected!");
|
||||
assert(bigVal.data() && "Null pointer detected!");
|
||||
if (isSingleWord())
|
||||
VAL = bigVal[0];
|
||||
else {
|
||||
// Get memory, cleared to 0
|
||||
pVal = getClearedMemory(getNumWords());
|
||||
// Calculate the number of words to copy
|
||||
unsigned words = std::min<unsigned>(numWords, getNumWords());
|
||||
unsigned words = std::min<unsigned>(bigVal.size(), getNumWords());
|
||||
// Copy the words from bigVal to pVal
|
||||
memcpy(pVal, bigVal, words * APINT_WORD_SIZE);
|
||||
memcpy(pVal, bigVal.data(), words * APINT_WORD_SIZE);
|
||||
}
|
||||
// Make sure unused high bits are cleared
|
||||
clearUnusedBits();
|
||||
}
|
||||
|
||||
APInt::APInt(unsigned numBits, ArrayRef<uint64_t> bigVal)
|
||||
: BitWidth(numBits), VAL(0) {
|
||||
initFromArray(bigVal);
|
||||
}
|
||||
|
||||
APInt::APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[])
|
||||
: BitWidth(numBits), VAL(0) {
|
||||
initFromArray(makeArrayRef(bigVal, numWords));
|
||||
}
|
||||
|
||||
APInt::APInt(unsigned numbits, StringRef Str, uint8_t radix)
|
||||
: BitWidth(numbits), VAL(0) {
|
||||
assert(BitWidth && "Bitwidth too small");
|
||||
|
||||
Reference in New Issue
Block a user