diff options
author | Andrii Riabushenko <cdome@bk.ru> | 2018-10-24 11:26:32 +0100 |
---|---|---|
committer | Andrii Riabushenko <cdome@bk.ru> | 2018-10-24 11:26:32 +0100 |
commit | bd68d3d8f4bffbb2451dee74f1475f12079d8e1e (patch) | |
tree | 8e6894766fcc8a56d0ec9af627f4b36208a0a68f | |
parent | a7c9533a73ea536014e279e39272995840400830 (diff) | |
download | Nim-bd68d3d8f4bffbb2451dee74f1475f12079d8e1e.tar.gz |
improve style
-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) |