1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 04:43:53 +00:00

Replace manual comparison with memcmp.

This commit is contained in:
Bartosz Taudul 2019-02-12 18:45:51 +01:00
parent e4e20b47ca
commit ec37f59c14

View File

@ -2,6 +2,7 @@
#define __TRACYVARARRAY_HPP__ #define __TRACYVARARRAY_HPP__
#include <stdint.h> #include <stdint.h>
#include <string.h>
#include "../common/TracyForceInline.hpp" #include "../common/TracyForceInline.hpp"
#include "tracy_flat_hash_map.hpp" #include "tracy_flat_hash_map.hpp"
@ -60,12 +61,7 @@ template<typename T>
bool Compare( const VarArray<T>& lhs, const VarArray<T>& rhs ) bool Compare( const VarArray<T>& lhs, const VarArray<T>& rhs )
{ {
if( lhs.size() != rhs.size() || lhs.get_hash() != rhs.get_hash() ) return false; if( lhs.size() != rhs.size() || lhs.get_hash() != rhs.get_hash() ) return false;
const auto sz = lhs.size(); return memcmp( lhs.data(), rhs.data(), lhs.size() * sizeof( T ) ) == 0;
for( uint8_t i=0; i<sz; i++ )
{
if( lhs[i] != rhs[i] ) return false;
}
return true;
} }
template<typename T> template<typename T>