mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-01 22:45:21 +00:00
Silence MSVC warning C4366.
warning C4366: The result of the unary '&' operator may be unaligned
This commit is contained in:
@@ -6,11 +6,17 @@
|
||||
|
||||
#include "TracyForceInline.hpp"
|
||||
|
||||
#if defined _MSC_VER && !defined _M_IX86
|
||||
# define TracyUnaligned __unaligned
|
||||
#else
|
||||
# define TracyUnaligned
|
||||
#endif
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
tracy_force_inline T MemRead( const T* ptr )
|
||||
tracy_force_inline T MemRead( const TracyUnaligned T* ptr )
|
||||
{
|
||||
T val;
|
||||
memcpy( &val, ptr, sizeof( T ) );
|
||||
@@ -18,7 +24,7 @@ tracy_force_inline T MemRead( const T* ptr )
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
tracy_force_inline void MemWrite( T* ptr, U val )
|
||||
tracy_force_inline void MemWrite( TracyUnaligned T* ptr, U val )
|
||||
{
|
||||
static_assert( std::is_same<T, U>::value, "MemWrite type mismatch" );
|
||||
memcpy( (void*)ptr, &val, sizeof( T ) );
|
||||
|
||||
Reference in New Issue
Block a user