Skip to content
Snippets Groups Projects
Commit 2c25f398 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed compareMemory method in ArrayOperations on host

parent 331a1265
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ freeMemory( Element* data ) ...@@ -39,6 +39,7 @@ freeMemory( Element* data )
delete[] data; delete[] data;
return true; return true;
} }
template< typename Element > template< typename Element >
void void
ArrayOperations< Devices::Host >:: ArrayOperations< Devices::Host >::
...@@ -95,7 +96,9 @@ copyMemory( DestinationElement* destination, ...@@ -95,7 +96,9 @@ copyMemory( DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
if( std::is_same< DestinationElement, SourceElement >::value ) if( std::is_same< DestinationElement, SourceElement >::value &&
( std::is_fundamental< DestinationElement >::value ||
std::is_pointer< DestinationElement >::value ) )
memcpy( destination, source, size * sizeof( DestinationElement ) ); memcpy( destination, source, size * sizeof( DestinationElement ) );
else else
for( Index i = 0; i < size; i ++ ) for( Index i = 0; i < size; i ++ )
...@@ -112,7 +115,9 @@ compareMemory( const DestinationElement* destination, ...@@ -112,7 +115,9 @@ compareMemory( const DestinationElement* destination,
const SourceElement* source, const SourceElement* source,
const Index size ) const Index size )
{ {
if( std::is_same< DestinationElement, SourceElement >::value ) if( std::is_same< DestinationElement, SourceElement >::value &&
( std::is_fundamental< DestinationElement >::value ||
std::is_pointer< DestinationElement >::value ) )
{ {
if( memcmp( destination, source, size * sizeof( DestinationElement ) ) != 0 ) if( memcmp( destination, source, size * sizeof( DestinationElement ) ) != 0 )
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment