fixes #20914; fixes the alignment of big sets (#20918)

* fixes #20914; fixes the align of bug sets

* add a test for alignof
This commit is contained in:
ringabout 2022-11-26 14:48:11 +08:00 • committed by GitHub
commit b57a9637e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View file

@ -319,10 +319,10 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
typ.align = int16(conf.floatInt64Align)
elif align(length, 8) mod 8 == 0:
typ.size = align(length, 8) div 8
typ.align = int16(conf.floatInt64Align)
typ.align = 1
else:
typ.size = align(length, 8) div 8 + 1
typ.align = int16(conf.floatInt64Align)
typ.align = 1
of tyRange:
computeSizeAlign(conf, typ[0])
typ.size = typ[0].size