| 89 | } |
| 90 | |
| 91 | void APInt::initFromArray(ArrayRef<uint64_t> bigVal) { |
| 92 | assert(BitWidth && "Bitwidth too small"); |
| 93 | assert(bigVal.data() && "Null pointer detected!"); |
| 94 | if (isSingleWord()) |
| 95 | U.VAL = bigVal[0]; |
| 96 | else { |
| 97 | // Get memory, cleared to 0 |
| 98 | U.pVal = getClearedMemory(getNumWords()); |
| 99 | // Calculate the number of words to copy |
| 100 | unsigned words = std::min<unsigned>(bigVal.size(), getNumWords()); |
| 101 | // Copy the words from bigVal to pVal |
| 102 | memcpy(U.pVal, bigVal.data(), words * APINT_WORD_SIZE); |
| 103 | } |
| 104 | // Make sure unused high bits are cleared |
| 105 | clearUnusedBits(); |
| 106 | } |
| 107 | |
| 108 | APInt::APInt(unsigned numBits, ArrayRef<uint64_t> bigVal) |
| 109 | : BitWidth(numBits) { |
nothing calls this directly
no test coverage detected