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)), List<unsigned int>(intSize(size)),
size_(size) size_(size)
{ {
for (label i = 0; i < size; i++) operator=(val);
{
set(i, val);
}
} }

View File

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