diff options
author | Chris Robinson <[email protected]> | 2018-01-07 22:20:08 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-07 22:20:08 -0800 |
commit | d547f52d8f4d584e9f6c3b56b8dd59f27e3dfe08 (patch) | |
tree | 4780f360faf2353240328990a8ad9a73e7f3f427 | |
parent | 56e9cb69d3aba60016701c6478b3f08c08aa3171 (diff) |
Move the UNEXPECTED macro to the main header and rename it
-rw-r--r-- | Alc/effects/reverb.c | 7 | ||||
-rw-r--r-- | Alc/uhjfilter.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 8 |
3 files changed, 10 insertions, 7 deletions
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 52e3ec09..1edd650f 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -54,11 +54,6 @@ ALboolean EmulateEAXReverb = AL_FALSE; */ #define FADE_SAMPLES 128 -#ifdef __GNUC__ -#define UNEXPECTED(x) __builtin_expect((bool)(x), 0) -#else -#define UNEXPECTED(x) (x) -#endif static RowMixerFunc MixRowSamples = MixRow_C; @@ -1868,7 +1863,7 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, c /* Process the samples for reverb. */ fade = ReverbProc(State, todo, fade, afmt, early, late); - if(UNEXPECTED(fadeCount < FADE_SAMPLES) && (fadeCount += todo) >= FADE_SAMPLES) + if(UNLIKELY(fadeCount < FADE_SAMPLES) && (fadeCount += todo) >= FADE_SAMPLES) { /* Update the cross-fading delay line taps. */ fadeCount = FADE_SAMPLES; diff --git a/Alc/uhjfilter.c b/Alc/uhjfilter.c index 8e2febae..6f9fb37d 100644 --- a/Alc/uhjfilter.c +++ b/Alc/uhjfilter.c @@ -20,7 +20,7 @@ static void allpass_process(AllPassState *state, ALfloat *restrict dst, const AL { ALsizei i; - if(todo > 1) + if(LIKELY(todo > 1)) { dst[0] = aa*(src[0] + state->y[1]) - state->x[1]; dst[1] = aa*(src[1] + state->y[0]) - state->x[0]; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index fe282c88..37baabed 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -203,6 +203,14 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format); #endif +#ifdef __GNUC__ +#define LIKELY(x) __builtin_expect(!!(x), !0) +#define UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define LIKELY(x) (!!(x)) +#define UNLIKELY(x) (!!(x)) +#endif + typedef ALint64SOFT ALint64; typedef ALuint64SOFT ALuint64; |