mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 06:20:38 +00:00
committed by
Andreas Rumpf
parent
8407a57499
commit
afbcd1b330
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user