parent
0fb878324e
commit
f8cac6bbbc
2 changed files with 13 additions and 4 deletions
|
|
@ -277,14 +277,14 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
|
||||||
typ.size = 4 # use signed int32
|
typ.size = 4 # use signed int32
|
||||||
typ.align = 4
|
typ.align = 4
|
||||||
else:
|
else:
|
||||||
let length = toInt64(lastOrd(conf, typ)) # BUGFIX: use lastOrd!
|
let lastOrd = toInt64(lastOrd(conf, typ)) # BUGFIX: use lastOrd!
|
||||||
if length + 1 < `shl`(1, 8):
|
if lastOrd < `shl`(1, 8):
|
||||||
typ.size = 1
|
typ.size = 1
|
||||||
typ.align = 1
|
typ.align = 1
|
||||||
elif length + 1 < `shl`(1, 16):
|
elif lastOrd < `shl`(1, 16):
|
||||||
typ.size = 2
|
typ.size = 2
|
||||||
typ.align = 2
|
typ.align = 2
|
||||||
elif length + 1 < `shl`(BiggestInt(1), 32):
|
elif lastOrd < `shl`(BiggestInt(1), 32):
|
||||||
typ.size = 4
|
typ.size = 4
|
||||||
typ.align = 4
|
typ.align = 4
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -154,3 +154,12 @@ block nonzero: # bug #6959
|
||||||
B
|
B
|
||||||
C
|
C
|
||||||
let slice = SomeEnum.low..SomeEnum.high
|
let slice = SomeEnum.low..SomeEnum.high
|
||||||
|
|
||||||
|
block size_one_byte: #issue 15752
|
||||||
|
type
|
||||||
|
Flag = enum
|
||||||
|
Disabled = 0x00
|
||||||
|
Enabled = 0xFF
|
||||||
|
|
||||||
|
static:
|
||||||
|
assert 1 == sizeof(Flag)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue