mirror of https://github.com/PCSX2/pcsx2.git
spu2x|common: s/jASSUME/pxAssume/ allow to remove code and __debugbreak intrinsic
This commit is contained in:
parent
c56ca4a0fa
commit
e872552fdc
|
@ -42,33 +42,6 @@
|
|||
# define ArraySize(x) (sizeof(x)/sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// jASSUME - give hints to the optimizer [obsolete, use pxAssume() instead]
|
||||
// --------------------------------------------------------------------------------------
|
||||
// This is primarily useful for the default case switch optimizer, which enables VC to
|
||||
// generate more compact switches.
|
||||
//
|
||||
// Note: When using the PCSX2 Utilities library, this is deprecated. Use pxAssert instead,
|
||||
// which itself optimizes to an __assume() hint in release mode builds.
|
||||
//
|
||||
#ifndef jASSUME
|
||||
# ifdef NDEBUG
|
||||
# define jBREAKPOINT() ((void) 0)
|
||||
# ifdef _MSC_VER
|
||||
# define jASSUME(exp) (__assume(exp))
|
||||
# else
|
||||
# define jASSUME(exp) do { if(!(exp)) __builtin_unreachable(); } while(0)
|
||||
# endif
|
||||
# else
|
||||
# define jBREAKPOINT() __debugbreak();
|
||||
# ifdef wxASSERT
|
||||
# define jASSUME(exp) wxASSERT(exp)
|
||||
# else
|
||||
# define jASSUME(exp) do { if(!(exp)) jBREAKPOINT(); } while(0)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Dev / Debug conditionals - Consts for using if() statements instead of uglier #ifdef.
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -25,7 +25,7 @@ static __fi void memset32( T& obj )
|
|||
// If the data length is not a factor of 32 bits, the C++ optimizing compiler will
|
||||
// probably just generate mysteriously broken code in Release builds. ;)
|
||||
|
||||
jASSUME( (sizeof(T) & 0x3) == 0 );
|
||||
pxAssume((sizeof(T) & 0x3) == 0);
|
||||
|
||||
u32* dest = (u32*)&obj;
|
||||
for( int i=sizeof(T)>>2; i; --i, ++dest )
|
||||
|
|
|
@ -75,11 +75,3 @@ static __inline__ __attribute__((always_inline)) unsigned long long _xgetbv(unsi
|
|||
__asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
|
||||
return ((unsigned long long)edx << 32) | eax;
|
||||
}
|
||||
|
||||
/*** Interrupts ***/
|
||||
#ifndef __linux__
|
||||
static __inline__ __attribute__((always_inline)) void __debugbreak(void)
|
||||
{
|
||||
__asm__("int $3");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ static int GetLinearSrAr( uint SrAr )
|
|||
|
||||
bool V_ADSR::Calculate()
|
||||
{
|
||||
jASSUME( Phase != 0 );
|
||||
pxAssume( Phase != 0 );
|
||||
|
||||
if(Releasing && (Phase < 5))
|
||||
Phase = 5;
|
||||
|
|
|
@ -69,8 +69,8 @@ protected:
|
|||
fprintf(stderr,"* SPU2-X:Iz in your external callback.\n");
|
||||
AlsaMod *data = (AlsaMod*)snd_async_handler_get_callback_private( pcm_call );
|
||||
|
||||
jASSUME( data != NULL );
|
||||
//jASSUME( data->handle == snd_async_handler_get_pcm(pcm_call) );
|
||||
pxAssume( data != NULL );
|
||||
//pxAssume( data->handle == snd_async_handler_get_pcm(pcm_call) );
|
||||
|
||||
// Not sure if we just need an assert, or something like this:
|
||||
if (data->handle != snd_async_handler_get_pcm(pcm_call))
|
||||
|
|
|
@ -398,7 +398,7 @@ static __forceinline void CalculateADSR( V_Core& thiscore, uint voiceidx )
|
|||
vc.Stop();
|
||||
}
|
||||
|
||||
jASSUME( vc.ADSR.Value >= 0 ); // ADSR should never be negative...
|
||||
pxAssume( vc.ADSR.Value >= 0 ); // ADSR should never be negative...
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -529,7 +529,7 @@ static __forceinline s32 GetNoiseValues( V_Core& thiscore, uint voiceidx )
|
|||
|
||||
// GetNoiseValues can't set the phase zero on us unexpectedly
|
||||
// like GetVoiceValues can. Better assert just in case though..
|
||||
jASSUME( vc.ADSR.Phase != 0 );
|
||||
pxAssume( vc.ADSR.Phase != 0 );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ static __forceinline void spu2M_WriteFast( u32 addr, s16 value )
|
|||
}
|
||||
// throw an assertion if the memory range is invalid:
|
||||
#ifndef DEBUG_FAST
|
||||
jASSUME( addr < SPU2_DYN_MEMLINE );
|
||||
pxAssume( addr < SPU2_DYN_MEMLINE );
|
||||
#endif
|
||||
*GetMemPtr( addr ) = value;
|
||||
}
|
||||
|
|
|
@ -671,7 +671,7 @@ EXPORT_C_(int) SPU2setupRecording(int start, void* pData)
|
|||
|
||||
EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data)
|
||||
{
|
||||
jASSUME( data != NULL );
|
||||
pxAssume( data != NULL );
|
||||
if ( !data )
|
||||
{
|
||||
printf("SPU2-X savestate null pointer!\n");
|
||||
|
@ -684,7 +684,7 @@ EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
jASSUME( mode == FREEZE_LOAD || mode == FREEZE_SAVE );
|
||||
pxAssume( mode == FREEZE_LOAD || mode == FREEZE_SAVE );
|
||||
|
||||
if( data->data == NULL )
|
||||
{
|
||||
|
|
|
@ -262,8 +262,8 @@ template<typename T> void SndBuffer::ReadSamples(T* bData)
|
|||
int quietSamples;
|
||||
if( CheckUnderrunStatus( nSamples, quietSamples ) )
|
||||
{
|
||||
jASSUME( nSamples <= SndOutPacketSize );
|
||||
|
||||
pxAssume( nSamples <= SndOutPacketSize );
|
||||
|
||||
// WARNING: This code assumes there's only ONE reading process.
|
||||
int b1 = m_size - m_rpos;
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ static void CvtPacketToFloat( StereoOut32* srcdest )
|
|||
// Parameter note: Size should always be a multiple of 128, thanks!
|
||||
static void CvtPacketToInt( StereoOut32* srcdest, uint size )
|
||||
{
|
||||
//jASSUME( (size & 127) == 0 );
|
||||
//pxAssume( (size & 127) == 0 );
|
||||
|
||||
const StereoOutFloat* src = (StereoOutFloat*)srcdest;
|
||||
StereoOut32* dest = srcdest;
|
||||
|
|
|
@ -476,7 +476,7 @@ BOOL CALLBACK DSound::ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam
|
|||
|
||||
BOOL CALLBACK DSound::DSEnumCallback( LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext )
|
||||
{
|
||||
jASSUME( DSoundOut != NULL );
|
||||
pxAssume( DSoundOut != NULL );
|
||||
return DS._DSEnumCallback( lpGuid, lpcstrDescription, lpcstrModule, lpContext );
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ public:
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
jASSUME(pXAudio2 == NULL);
|
||||
pxAssume(pXAudio2 == NULL);
|
||||
|
||||
xAudio2DLL = LoadLibraryEx(XAUDIO2_DLL, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
if (xAudio2DLL == nullptr)
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
jASSUME( pXAudio2 == NULL );
|
||||
pxAssume( pXAudio2 == NULL );
|
||||
|
||||
// On some systems XAudio2.7 can unload itself and cause PCSX2 to crash.
|
||||
// Maintain an extra library reference so it can't do so. Does not
|
||||
|
@ -291,7 +291,7 @@ public:
|
|||
}
|
||||
|
||||
// Any windows driver should support stereo at the software level, I should think!
|
||||
jASSUME( deviceDetails.OutputFormat.Format.nChannels > 1 );
|
||||
pxAssume( deviceDetails.OutputFormat.Format.nChannels > 1 );
|
||||
|
||||
//
|
||||
// Create a mastering voice
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
speakerConfig = 2; // better not mess with this in wavout :p (rama)
|
||||
|
||||
// Any windows driver should support stereo at the software level, I should think!
|
||||
jASSUME( speakerConfig > 1 );
|
||||
pxAssume( speakerConfig > 1 );
|
||||
LPTHREAD_START_ROUTINE threadproc;
|
||||
|
||||
switch( speakerConfig )
|
||||
|
|
|
@ -57,7 +57,7 @@ __forceinline s16* GetMemPtr(u32 addr)
|
|||
#ifndef DEBUG_FAST
|
||||
// In case you're wondering, this assert is the reason SPU2-X
|
||||
// runs so incrediously slow in Debug mode. :P
|
||||
jASSUME( addr < 0x100000 );
|
||||
pxAssume( addr < 0x100000 );
|
||||
#endif
|
||||
return (_spu2mem+addr);
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ void V_VolumeSlide::RegSet( u16 src )
|
|||
|
||||
void V_Core::WriteRegPS1( u32 mem, u16 value )
|
||||
{
|
||||
jASSUME( Index == 0 ); // Valid on Core 0 only!
|
||||
pxAssume( Index == 0 ); // Valid on Core 0 only!
|
||||
|
||||
bool show = true;
|
||||
u32 reg = mem & 0xffff;
|
||||
|
@ -641,7 +641,7 @@ void V_Core::WriteRegPS1( u32 mem, u16 value )
|
|||
|
||||
u16 V_Core::ReadRegPS1(u32 mem)
|
||||
{
|
||||
jASSUME( Index == 0 ); // Valid on Core 0 only!
|
||||
pxAssume( Index == 0 ); // Valid on Core 0 only!
|
||||
|
||||
bool show=true;
|
||||
u16 value = spu2Ru16(mem);
|
||||
|
|
Loading…
Reference in New Issue