Commit 9a19f515 authored by mattijs's avatar mattijs
Browse files

optimisation of assignment

parent 36fcd1cd
......@@ -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);
}
......
......@@ -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);
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment