1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed append alloc array size calculation

This commit is contained in:
Brian Fiete 2020-11-16 09:46:25 -08:00
parent 234b3591eb
commit 826a7e6fba

View file

@ -617,7 +617,7 @@ public:
{
curAlign = resultType->mAlign;
EmitAppendAlign(resultType->mAlign);
sizeValue = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->mSize), allocCount);
sizeValue = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->GetStride()), allocCount);
}
else
{
@ -633,7 +633,7 @@ public:
int arrayClassSize = arrayType->mInstSize - firstElementField->mDataSize;
sizeValue = mModule->GetConstValue(arrayClassSize);
BfIRValue elementDataSize = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->mSize), allocCount);
BfIRValue elementDataSize = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->GetStride()), allocCount);
sizeValue = mModule->mBfIRBuilder->CreateAdd(sizeValue, elementDataSize);
}
}