diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-01-20 14:08:32 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-01-20 14:08:32 -0600 |
| commit | 982c63a71712fc9092b35fca3ef34e4b404c03cb (patch) | |
| tree | 7d70baa39eba037f19302f9143c81fa2dd5a980b /shared-module/audiomixer/Mixer.c | |
| parent | 449dbea4567dbc27a01ae695b9cebf776a6927f0 (diff) | |
Mixer: use MP_LIKELY macro instead of locally brewed one
Diffstat (limited to 'shared-module/audiomixer/Mixer.c')
| -rw-r--r-- | shared-module/audiomixer/Mixer.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/shared-module/audiomixer/Mixer.c b/shared-module/audiomixer/Mixer.c index 3c1c9a491..9370adf01 100644 --- a/shared-module/audiomixer/Mixer.c +++ b/shared-module/audiomixer/Mixer.c @@ -140,8 +140,6 @@ static inline uint32_t pack8(uint32_t val) { return ((val & 0xff000000) >> 16) | ((val & 0xff00) >> 8); } -#define LIKELY(x) (__builtin_expect(!!(x), 1)) -#define UNLIKELY(x) (__builtin_expect(!!(x), 0)) static void mix_one_voice(audiomixer_mixer_obj_t* self, audiomixer_mixervoice_obj_t* voice, bool voices_active, uint32_t* word_buffer, uint32_t length) { @@ -172,8 +170,8 @@ static void mix_one_voice(audiomixer_mixer_obj_t* self, // First active voice gets copied over verbatim. if (!voices_active) { - if (LIKELY(self->bits_per_sample == 16)) { - if (LIKELY(self->samples_signed)) { + if (MP_LIKELY(self->bits_per_sample == 16)) { + if (MP_LIKELY(self->samples_signed)) { for (uint32_t i = 0; i<n; i++) { uint32_t v = src[i]; word_buffer[i] = mult16signed(v, level); @@ -190,7 +188,7 @@ static void mix_one_voice(audiomixer_mixer_obj_t* self, uint16_t *hsrc = (uint16_t*)src; for (uint32_t i = 0; i<n*2; i++) { uint32_t word = unpack8(hsrc[i]); - if (LIKELY(!self->samples_signed)) { + if (MP_LIKELY(!self->samples_signed)) { word = tosigned16(word); } word = mult16signed(word, level); @@ -198,8 +196,8 @@ static void mix_one_voice(audiomixer_mixer_obj_t* self, } } } else { - if (LIKELY(self->bits_per_sample == 16)) { - if (LIKELY(self->samples_signed)) { + if (MP_LIKELY(self->bits_per_sample == 16)) { + if (MP_LIKELY(self->samples_signed)) { for (uint32_t i = 0; i<n; i++) { uint32_t word = src[i]; word_buffer[i] = add16signed(mult16signed(word, level), word_buffer[i]); @@ -216,7 +214,7 @@ static void mix_one_voice(audiomixer_mixer_obj_t* self, uint16_t *hsrc = (uint16_t*)src; for (uint32_t i = 0; i<n*2; i++) { uint32_t word = unpack8(hsrc[i]); - if (LIKELY(!self->samples_signed)) { + if (MP_LIKELY(!self->samples_signed)) { word = tosigned16(word); } word = mult16signed(word, level); |
