diff options
Diffstat (limited to 'compiler/vmgen.nim')
-rw-r--r-- | compiler/vmgen.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 26efea683..527c3cf2e 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -776,11 +776,11 @@ proc genCastIntFloat(c: PCtx; n: PNode; dest: var TDest) = let src = n.sons[1].typ.skipTypes(abstractRange)#.kind let dst = n.sons[0].typ.skipTypes(abstractRange)#.kind let src_size = getSize(c.config, src) - + let dst_size = getSize(c.config, dst) if c.config.target.intSize < 8: signedIntegers.incl(tyInt) unsignedIntegers.incl(tyUInt) - if src_size == getSize(c.config, dst) and src.kind in allowedIntegers and + if src_size == dst_size and src.kind in allowedIntegers and dst.kind in allowedIntegers: let tmp = c.genx(n.sons[1]) var tmp2 = c.getTemp(n.sons[1].typ) @@ -809,7 +809,7 @@ proc genCastIntFloat(c: PCtx; n: PNode; dest: var TDest) = c.freeTemp(tmp) c.freeTemp(tmp2) c.freeTemp(tmp3) - elif src_size == getSize(c.config, dst) and src.kind in allowedIntegers and + elif src_size == dst_size and src.kind in allowedIntegers and dst.kind in {tyFloat, tyFloat32, tyFloat64}: let tmp = c.getTemp(n.sons[1].typ) @@ -820,7 +820,7 @@ proc genCastIntFloat(c: PCtx; n: PNode; dest: var TDest) = c.gABC(n, opcAsgnFloat64FromInt, dest, tmp) c.freeTemp(tmp) - elif src_size == getSize(c.config, dst) and src.kind in {tyFloat, tyFloat32, tyFloat64} and + elif src_size == dst_size and src.kind in {tyFloat, tyFloat32, tyFloat64} and dst.kind in allowedIntegers: let tmp = c.getTemp(n.sons[1].typ) |