Commit e594db0a authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed initialization of empty arrays in multimaps

parent a73752d3
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -80,9 +80,11 @@ allocate( const LocalIndexType& maxValuesCount )
   const IndexType ldSize = getAllocationKeysRange( this->getKeysRange() );
   this->values.setSize( ldSize * this->maxValuesCount );
   this->valuesCounts.setSize( this->getKeysRange() );
   if( this->valuesCounts.getSize() > 0 )
      this->valuesCounts.setValue( maxValuesCount );

   // extra cost at initialization, which allows to have much simpler operator==
   if( this->values.getSize() > 0 )
      values.setValue( 0 );
}

@@ -108,6 +110,7 @@ allocate( const ValuesAllocationVectorType& valuesCounts )
   this->valuesCounts = valuesCounts;

   // extra cost at initialization, which allows to have much simpler operator==
   if( this->values.getSize() > 0 )
      values.setValue( 0 );
}

@@ -128,6 +131,7 @@ setLike( const EllpackIndexMultimap< Index, Device_, LocalIndex, SliceSize_ >& o
   maxValuesCount = other.maxValuesCount;

   // extra cost at initialization, which allows to have much simpler operator==
   if( this->values.getSize() > 0 )
      values.setValue( 0 );
}

+4 −2
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ allocate()
   values.setSize( ldSize * ValuesCount );

   // extra cost at initialization, which allows to have much simpler operator==
   if( ldSize > 0 )
      values.setValue( 0 );
}

@@ -99,6 +100,7 @@ setLike( const StaticEllpackIndexMultimap< ValuesCount, Index, Device_, LocalInd
   values.setSize( ldSize * ValuesCount );

   // extra cost at initialization, which allows to have much simpler operator==
   if( ldSize > 0 )
      values.setValue( 0 );

   keysRange = other.keysRange;