summaryrefslogtreecommitdiffstats
path: root/media/libeffects/testlibs/AudioCommon.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-12-15 09:51:17 -0800
committerGlenn Kasten <gkasten@google.com>2012-01-05 07:33:45 -0800
commitf6b1678f8f508b447155a81b44e214475ab634a8 (patch)
treedabe2858dfed9133c6a270cd6b86877a9d3588b1 /media/libeffects/testlibs/AudioCommon.h
parent94023fa6744e24f26f0aba1699ec278649bd66df (diff)
downloadframeworks_av-f6b1678f8f508b447155a81b44e214475ab634a8.zip
frameworks_av-f6b1678f8f508b447155a81b44e214475ab634a8.tar.gz
frameworks_av-f6b1678f8f508b447155a81b44e214475ab634a8.tar.bz2
Use the standard CC_LIKELY and CC_UNLIKELY macros
Several source files privately defined macros LIKELY and UNLIKELY in terms of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and CC_UNLIKELY which are intended for this purpose. So rename the private uses to use the standard names. In addition, AudioFlinger was relying on the macro expanding to extra ( ). Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
Diffstat (limited to 'media/libeffects/testlibs/AudioCommon.h')
-rw-r--r--media/libeffects/testlibs/AudioCommon.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libeffects/testlibs/AudioCommon.h b/media/libeffects/testlibs/AudioCommon.h
index 444f93a..e8080dc 100644
--- a/media/libeffects/testlibs/AudioCommon.h
+++ b/media/libeffects/testlibs/AudioCommon.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <stddef.h>
+#include <cutils/compiler.h>
namespace android {
@@ -76,9 +77,9 @@ inline int16_t audio_sample_t_to_s15(audio_sample_t sample) {
// Convert a audio_sample_t sample to S15 (with clipping)
inline int16_t audio_sample_t_to_s15_clip(audio_sample_t sample) {
// TODO: optimize for targets supporting this as an atomic operation.
- if (__builtin_expect(sample >= (0x7FFF << 9), 0)) {
+ if (CC_UNLIKELY(sample >= (0x7FFF << 9))) {
return 0x7FFF;
- } else if (__builtin_expect(sample <= -(0x8000 << 9), 0)) {
+ } else if (CC_UNLIKELY(sample <= -(0x8000 << 9))) {
return 0x8000;
} else {
return audio_sample_t_to_s15(sample);