================ @@ -14674,6 +14676,31 @@ static bool TryEvaluateBuiltinNaN(const ASTContext &Context, return true; } +// Checks that the value x is in the range (-1;-0.5], [0.5; 1) +static bool isInFrexpResultRange(const llvm::APFloat &x) { + llvm::APFloat minusOne(x.getSemantics(), "-1.0"); + llvm::APFloat minusHalf(x.getSemantics(), "-0.5"); + llvm::APFloat half(x.getSemantics(), "0.5"); + llvm::APFloat one(x.getSemantics(), "1.0"); + + return ((x.compare(minusOne) == llvm::APFloat::cmpGreaterThan && + x.compare(minusHalf) != llvm::APFloat::cmpGreaterThan) || + (x.compare(half) != llvm::APFloat::cmpLessThan && + x.compare(one) == llvm::APFloat::cmpLessThan)); +} + +void FloatExprEvaluator::StoreExponent(LValue Pointer, int exp) { + const APValue::LValueBase Base = Pointer.getLValueBase(); + auto *VD = const_cast<ValueDecl *>(Base.dyn_cast<const ValueDecl *>()); + if (auto *VarD = dyn_cast<VarDecl>(VD)) { + clang::IntegerLiteral *IL = + clang::IntegerLiteral::Create(Info.Ctx, llvm::APSInt(32, exp), + Info.Ctx.IntTy, clang::SourceLocation()); + VarD->setInit(IL); ---------------- zahiraam wrote:
Not really sure what I should be looking at here. Are you objecting to the way StoreExponent is written? https://github.com/llvm/llvm-project/pull/88978 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits