diff --git a/common/include/Pcsx2Defs.h b/common/include/Pcsx2Defs.h index 1acf59561..7c0ab6938 100644 --- a/common/include/Pcsx2Defs.h +++ b/common/include/Pcsx2Defs.h @@ -77,7 +77,11 @@ extern "C" unsigned __int64 __xgetbv(int); // restaints must be enforced). // #ifndef C_ASSERT -# define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] + #ifdef __LINUX__ + # define C_ASSERT(e) static_assert(e, "this is a nice message to explain the failure ;)") + #else + # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] + #endif #endif // -------------------------------------------------------------------------------------- diff --git a/common/include/Utilities/lnx_memzero.h b/common/include/Utilities/lnx_memzero.h index e787acea2..c7dba5a76 100644 --- a/common/include/Utilities/lnx_memzero.h +++ b/common/include/Utilities/lnx_memzero.h @@ -51,8 +51,10 @@ static __fi void memset8( T& obj ) // Aligned sizes use the optimized 32 bit inline memset. Unaligned sizes use memset. if( (sizeof(T) & 0x3) != 0 ) memset( &obj, data, sizeof( T ) ); - else - memset32( obj ); + else { + const u32 data32 = data + (data<<8) + (data<<16) + (data<<24); + memset32( obj ); + } } template< u16 data, typename T > @@ -60,8 +62,10 @@ static __fi void memset16( T& obj ) { if( (sizeof(T) & 0x3) != 0 ) _memset16_unaligned( &obj, data, sizeof( T ) ); - else - memset32( obj ); + else { + const u32 data32 = data + (data<<16); + memset32( obj ); + } } @@ -92,6 +96,7 @@ static __fi void memset_8( void *dest ) // macro to execute the x86/32 "stosd" copies. switch( remdat ) { +#if 0 case 1: *(u32*)dest = data32; return; @@ -157,6 +162,7 @@ static __fi void memset_8( void *dest ) ); return; +#endif default: __asm__ volatile diff --git a/common/src/Utilities/Mutex.cpp b/common/src/Utilities/Mutex.cpp index 8ae6cd0e5..73ef0a18b 100644 --- a/common/src/Utilities/Mutex.cpp +++ b/common/src/Utilities/Mutex.cpp @@ -77,8 +77,8 @@ Threading::MutexRecursive::MutexRecursive() : Mutex( false ) pthread_mutexattr_settype( &_attr_recursive, PTHREAD_MUTEX_RECURSIVE ); } - int err = 0; - err = pthread_mutex_init( &m_mutex, &_attr_recursive ); + if (pthread_mutex_init( &m_mutex, &_attr_recursive )); + Console.Error( "(Thread Log) Failed to initialize mutex."); } Threading::MutexRecursive::~MutexRecursive() throw()