mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 10:57:35 +03:00
Fix static array null assignment/default initialization
This commit is contained in:
parent
901f015ce4
commit
19fd4938be
1 changed files with 10 additions and 2 deletions
|
@ -270,8 +270,16 @@ void DtoArrayAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPost
|
||||||
// fast version
|
// fast version
|
||||||
LLValue* elemSize = DtoConstSize_t(getTypePaddedSize(voidToI8(DtoType(elemType))));
|
LLValue* elemSize = DtoConstSize_t(getTypePaddedSize(voidToI8(DtoType(elemType))));
|
||||||
LLValue* lhsSize = gIR->ir->CreateMul(elemSize, lhsLength);
|
LLValue* lhsSize = gIR->ir->CreateMul(elemSize, lhsLength);
|
||||||
LLValue* rhsSize = gIR->ir->CreateMul(elemSize, rhsLength);
|
|
||||||
copySlice(loc, lhsPtr, lhsSize, rhsPtr, rhsSize);
|
if (rhs->isNull())
|
||||||
|
{
|
||||||
|
DtoMemSetZero(lhsPtr, lhsSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LLValue* rhsSize = gIR->ir->CreateMul(elemSize, rhsLength);
|
||||||
|
copySlice(loc, lhsPtr, lhsSize, rhsPtr, rhsSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (isConstructing)
|
else if (isConstructing)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue