diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C index ab98111778..7c20b200b3 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C @@ -40,10 +40,7 @@ PackedList::PackedList(const label size, const unsigned int val) List(intSize(size)), size_(size) { - for (label i = 0; i < size; i++) - { - set(i, val); - } + operator=(val); } diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H index 5ca70825cc..8e24a291bc 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H @@ -221,9 +221,16 @@ inline void PackedList::operator=(const unsigned int val) checkValue(val); # endif - for (label i = 0; i < size_; i++) + if (val == 0) { - set(i, val); + List::operator=(val); + } + else + { + for (label i = 0; i < size_; i++) + { + set(i, val); + } } }