optimisation of assignment

This commit is contained in:
mattijs
2008-09-16 21:15:53 +01:00
parent 36fcd1cda6
commit 9a19f515d6
2 changed files with 10 additions and 6 deletions

View File

@ -40,10 +40,7 @@ PackedList<nBits>::PackedList(const label size, const unsigned int val)
List<unsigned int>(intSize(size)),
size_(size)
{
for (label i = 0; i < size; i++)
{
set(i, val);
}
operator=(val);
}

View File

@ -221,9 +221,16 @@ inline void PackedList<nBits>::operator=(const unsigned int val)
checkValue(val);
# endif
for (label i = 0; i < size_; i++)
if (val == 0)
{
set(i, val);
List<unsigned int>::operator=(val);
}
else
{
for (label i = 0; i < size_; i++)
{
set(i, val);
}
}
}