mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-26 11:38:02 +02:00
Fixed packing issue, made Packed infer Ordered
This commit is contained in:
parent
76c8b62780
commit
cf7914f71a
2 changed files with 16 additions and 1 deletions
|
@ -2146,6 +2146,8 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
|||
bool isCRepr = false;
|
||||
bool isOrdered = false;
|
||||
ProcessTypeInstCustomAttributes(isPacked, isUnion, isCRepr, isOrdered);
|
||||
if (isPacked) // Packed infers ordered
|
||||
isOrdered = true;
|
||||
typeInstance->mIsUnion = isUnion;
|
||||
if ((typeInstance->IsEnum()) && (typeInstance->IsStruct()))
|
||||
typeInstance->mIsUnion = true;
|
||||
|
@ -2783,7 +2785,9 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
|||
|
||||
bool needsExplicitAlignment = !isCRepr || resolvedFieldType->NeedsExplicitAlignment();
|
||||
|
||||
int nextDataPos = (dataPos + (alignSize - 1)) & ~(alignSize - 1);
|
||||
int nextDataPos = dataPos;
|
||||
if (!isPacked)
|
||||
nextDataPos = (dataPos + (alignSize - 1)) & ~(alignSize - 1);
|
||||
int padding = nextDataPos - dataPos;
|
||||
if ((alignSize > 1) && (needsExplicitAlignment) && (padding > 0))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue