Commit 3b19d7bc authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added missing assertions to the MemoryOperations specialization for Devices::Sequential

parent 2f4fdb72
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ MemoryOperations< Devices::Sequential >::
setElement( Element* data,
            const Element& value )
{
   TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
   *data = value;
}

@@ -31,6 +32,7 @@ Element
MemoryOperations< Devices::Sequential >::
getElement( const Element* data )
{
   TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
   return *data;
}

@@ -42,6 +44,8 @@ set( Element* data,
     const Element& value,
     const Index size )
{
   if( size == 0 ) return;
   TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
   for( Index i = 0; i < size; i++ )
      data[ i ] = value;
}
@@ -56,6 +60,10 @@ copy( DestinationElement* destination,
      const SourceElement* source,
      const Index size )
{
   if( size == 0 ) return;
   TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
   TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );

   for( Index i = 0; i < size; i++ )
      destination[ i ] = source[ i ];
}
@@ -87,6 +95,10 @@ compare( const Element1* destination,
         const Element2* source,
         const Index size )
{
   if( size == 0 ) return true;
   TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
   TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );

   for( Index i = 0; i < size; i++ )
      if( ! ( destination[ i ] == source[ i ] ) )
         return false;