* fixed alignment of bitpacked arrays of ordinals/enums: the prevous code

always returned the alignment of enum/ordinal by itself, which could be
    either bigger or smaller than what was required
  * for non-bitpacked regular arrays, always use the alignment of the elements
    instead of sometimes the natural alignment of the size of the elements
    (which can be different)

git-svn-id: trunk@26019 -
This commit is contained in:
Jonas Maebe 2013-11-10 21:22:28 +00:00
parent dea947f87b
commit c1cec52897

View File

@ -3427,16 +3427,13 @@ implementation
{ alignment of dyn. arrays doesn't depend on the element size }
if (ado_IsDynamicArray in arrayoptions) then
alignment:=size_2_align(sizeof(pint))
{ alignment is the target alignment for the used load size }
else if (ado_IsBitPacked in arrayoptions) and
(elementdef.typ in [enumdef,orddef]) then
alignment:=cgsize_orddef(int_cgsize(packedbitsloadsize(elepackedbitsize))).alignment
{ alignment is the alignment of the elements }
else if (elementdef.typ in [arraydef,recorddef,orddef,enumdef,floatdef]) or
((elementdef.typ=objectdef) and
is_object(elementdef)) then
alignment:=elementdef.alignment
{ alignment is the size of the elements }
else if not (ado_IsBitPacked in arrayoptions) then
alignment:=size_2_align(elesize)
else
alignment:=packedbitsloadsize(elepackedbitsize);
alignment:=elementdef.alignment
end;