本文整理汇总了C++中APInt::getNumWords方法的典型用法代码示例。如果您正苦于以下问题:C++ APInt::getNumWords方法的具体用法?C++ APInt::getNumWords怎么用?C++ APInt::getNumWords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APInt
的用法示例。
在下文中一共展示了APInt::getNumWords方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setIntValue
void APNumericStorage::setIntValue(ASTContext &C, const APInt &Val) {
if (hasAllocation())
C.Deallocate(pVal);
BitWidth = Val.getBitWidth();
unsigned NumWords = Val.getNumWords();
const uint64_t* Words = Val.getRawData();
if (NumWords > 1) {
pVal = new (C) uint64_t[NumWords];
std::copy(Words, Words + NumWords, pVal);
} else if (NumWords == 1)
VAL = Words[0];
else
VAL = 0;
}
示例2: getInteger
SymbolicValue SymbolicValue::getInteger(const APInt &value,
ASTContext &astContext) {
// In the common case, we can form an inline representation.
unsigned numWords = value.getNumWords();
if (numWords == 1)
return getInteger(value.getRawData()[0], value.getBitWidth());
// Copy the integers from the APInt into the bump pointer.
auto *words = astContext.Allocate<uint64_t>(numWords).data();
std::uninitialized_copy(value.getRawData(), value.getRawData() + numWords,
words);
SymbolicValue result;
result.representationKind = RK_Integer;
result.value.integer = words;
result.auxInfo.integerBitwidth = value.getBitWidth();
return result;
}
示例3: toMpz
/** Converts v to mpz_class. Assumes that v is signed */
inline mpz_class toMpz (const APInt &v)
{
// Based on:
// https://llvm.org/svn/llvm-project/polly/trunk/lib/Support/GICHelper.cpp
// return v.getSExtValue ();
APInt abs;
abs = v.isNegative () ? v.abs () : v;
const uint64_t *rawdata = abs.getRawData ();
unsigned numWords = abs.getNumWords ();
// TODO: Check if this is true for all platforms.
mpz_class res;
mpz_import(res.get_mpz_t (), numWords, 1, sizeof (uint64_t), 0, 0, rawdata);
return v.isNegative () ? mpz_class(-res) : res;
}
示例4: LLVM_General_GetConstantFloatWords
void LLVM_General_GetConstantFloatWords(LLVMValueRef v, uint64_t *bits) {
APInt a = unwrap<ConstantFP>(v)->getValueAPF().bitcastToAPInt();
for(unsigned i=0; i != a.getNumWords(); ++i) bits[i] = a.getRawData()[i];
}