summary refs log tree commit diff stats
path: root/compiler/sizealignoffsetimpl.nim
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-08-07 15:53:16 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-08-07 15:53:16 +0200
commitafbcd1b330f16294cee32efca1b2f9060874a497 (patch)
treed0406792478fa58d3c487ff6f72f999c29f25343 /compiler/sizealignoffsetimpl.nim
parent8407a574992ebd6bccec647a902cf54a4de8db18 (diff)
downloadNim-afbcd1b330f16294cee32efca1b2f9060874a497.tar.gz
int128 on firstOrd, lastOrd and lengthOrd (#11701)
* fixes #11847
Diffstat (limited to 'compiler/sizealignoffsetimpl.nim')
-rw-r--r--compiler/sizealignoffsetimpl.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sizealignoffsetimpl.nim
index 34384fa1f..6028ba5ee 100644
--- a/compiler/sizealignoffsetimpl.nim
+++ b/compiler/sizealignoffsetimpl.nim
@@ -332,7 +332,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
       typ.size = elemSize
       typ.align = int16(elemSize)
     else:
-      typ.size = lengthOrd(conf, typ.sons[0]) * elemSize
+      typ.size = toInt64(lengthOrd(conf, typ.sons[0]) * int32(elemSize))
       typ.align = typ.sons[1].align
 
   of tyUncheckedArray:
@@ -341,11 +341,11 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
     typ.size = 0
     typ.align = base.align
   of tyEnum:
-    if firstOrd(conf, typ) < 0:
+    if firstOrd(conf, typ) < Zero:
       typ.size = 4              # use signed int32
       typ.align = 4
     else:
-      length = lastOrd(conf, typ)   # BUGFIX: use lastOrd!
+      length = toInt64(lastOrd(conf, typ))   # BUGFIX: use lastOrd!
       if length + 1 < `shl`(1, 8):
         typ.size = 1
         typ.align = 1
@@ -363,7 +363,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
       typ.size = szUncomputedSize
       typ.align = szUncomputedSize # in original version this was 1
     else:
-      length = lengthOrd(conf, typ.sons[0])
+      length = toInt64(lengthOrd(conf, typ.sons[0]))
       if length <= 8:
         typ.size = 1
       elif length <= 16: