diff options
author | Araq <rumpf_a@web.de> | 2019-09-02 10:27:35 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-09-02 10:27:35 +0200 |
commit | e76568764698be7561501c4809e996f3f1608f74 (patch) | |
tree | 04700154851f27af457836751a8425882b50e97d /compiler/semfold.nim | |
parent | e6ec88d4c39c458404061198b2a2f6b86c2caeaf (diff) | |
parent | ad82e65387f39970b0f12cbcb12d8b382236f3da (diff) | |
download | Nim-e76568764698be7561501c4809e996f3f1608f74.tar.gz |
Merge branch 'devel' into uint-range-checks
Diffstat (limited to 'compiler/semfold.nim')
-rw-r--r-- | compiler/semfold.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 38b29344f..bfb5077d6 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -50,7 +50,10 @@ proc newIntNodeT*(intVal: Int128, n: PNode; g: ModuleGraph): PNode = result.info = n.info proc newFloatNodeT*(floatVal: BiggestFloat, n: PNode; g: ModuleGraph): PNode = - result = newFloatNode(nkFloatLit, floatVal) + if n.typ.skipTypes(abstractInst).kind == tyFloat32: + result = newFloatNode(nkFloat32Lit, floatVal) + else: + result = newFloatNode(nkFloatLit, floatVal) result.typ = n.typ result.info = n.info @@ -176,7 +179,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; g: ModuleGraph): PNode = of mOrd: result = newIntNodeT(getOrdValue(a), n, g) of mChr: result = newIntNodeT(getInt(a), n, g) of mUnaryMinusI, mUnaryMinusI64: result = foldUnarySub(getInt(a), n, g) - of mUnaryMinusF64: result = newFloatNodeT(- getFloat(a), n, g) + of mUnaryMinusF64: result = newFloatNodeT(-getFloat(a), n, g) of mNot: result = newIntNodeT(One - getInt(a), n, g) of mCard: result = newIntNodeT(nimsets.cardSet(g.config, a), n, g) of mBitnotI: @@ -193,10 +196,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; g: ModuleGraph): PNode = else: result = newIntNodeT(toInt128(sonsLen(a)), n, g) of mUnaryPlusI, mUnaryPlusF64: result = a # throw `+` away - of mToFloat, mToBiggestFloat: - result = newFloatNodeT(toFloat64(getInt(a)), n, g) # XXX: Hides overflow/underflow - of mToInt, mToBiggestInt: result = newIntNodeT(system.toInt(getFloat(a)), n, g) of mAbsF64: result = newFloatNodeT(abs(getFloat(a)), n, g) of mAbsI: result = foldAbs(getInt(a), n, g) of mUnaryLt: result = foldSub(getOrdValue(a), One, n, g) |