当前位置: 首页>>代码示例>>C++>>正文


C++ APInt::getNumWords方法代码示例

本文整理汇总了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;
}
开发者ID:isanbard,项目名称:flang,代码行数:15,代码来源:Expr.cpp

示例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;
}
开发者ID:phausler,项目名称:swift,代码行数:18,代码来源:SILConstants.cpp

示例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;
  }
开发者ID:HUST-PLT,项目名称:seahorn,代码行数:19,代码来源:ExprLlvm.hpp

示例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];
}
开发者ID:a-ford,项目名称:ghc,代码行数:4,代码来源:ConstantC.cpp


注:本文中的APInt::getNumWords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。