From f6b1678f8f508b447155a81b44e214475ab634a8 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Thu, 15 Dec 2011 09:51:17 -0800 Subject: Use the standard CC_LIKELY and CC_UNLIKELY macros Several source files privately defined macros LIKELY and UNLIKELY in terms of __builtin_expect. But 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 --- media/libeffects/testlibs/AudioShelvingFilter.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'media/libeffects/testlibs/AudioShelvingFilter.cpp') diff --git a/media/libeffects/testlibs/AudioShelvingFilter.cpp b/media/libeffects/testlibs/AudioShelvingFilter.cpp index b8650ba..e031287 100644 --- a/media/libeffects/testlibs/AudioShelvingFilter.cpp +++ b/media/libeffects/testlibs/AudioShelvingFilter.cpp @@ -21,9 +21,7 @@ #include #include - -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) +#include namespace android { // Format of the coefficient tables: @@ -71,13 +69,13 @@ void AudioShelvingFilter::reset() { void AudioShelvingFilter::setFrequency(uint32_t millihertz) { mNominalFrequency = millihertz; - if (UNLIKELY(millihertz > mNiquistFreq / 2)) { + if (CC_UNLIKELY(millihertz > mNiquistFreq / 2)) { millihertz = mNiquistFreq / 2; } uint32_t normFreq = static_cast( (static_cast(millihertz) * mFrequencyFactor) >> 10); uint32_t log2minFreq = (mType == kLowShelf ? (32-10) : (32-2)); - if (LIKELY(normFreq > (1U << log2minFreq))) { + if (CC_LIKELY(normFreq > (1U << log2minFreq))) { mFrequency = (Effects_log2(normFreq) - (log2minFreq << 15)) << (FREQ_PRECISION_BITS - 15); } else { mFrequency = 0; -- cgit v1.1