diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2021-01-11 08:07:48 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 15:07:48 +0100 |
commit | aa185c0e9b4904b305496bd1f83cbbadf2fbfa36 (patch) | |
tree | 3ecb497224682212ace87949baa650f359a806db /compiler | |
parent | be6e8916faa51d227d51e1291d1f24751385b010 (diff) | |
download | Nim-aa185c0e9b4904b305496bd1f83cbbadf2fbfa36.tar.gz |
fix #13517 (#16681)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vm.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index b8df456e0..00f0aca7c 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -429,13 +429,13 @@ proc opConv(c: PCtx; dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType): return true of tyUInt..tyUInt64: dest.ensureKind(rkInt) - case skipTypes(srctyp, abstractRange).kind + let styp = srctyp.skipTypes(abstractRange) # skip distinct types(dest type could do this too if needed) + case styp.kind of tyFloat..tyFloat64: dest.intVal = int(src.floatVal) else: - let srcDist = (sizeof(src.intVal) - srctyp.size) * 8 + let srcDist = (sizeof(src.intVal) - styp.size) * 8 let destDist = (sizeof(dest.intVal) - desttyp.size) * 8 - var value = cast[BiggestUInt](src.intVal) value = (value shl srcDist) shr srcDist value = (value shl destDist) shr destDist |