diff options
| author | 2011-12-15 09:51:17 -0800 | |
|---|---|---|
| committer | 2012-01-05 07:33:45 -0800 | |
| commit | e80a4ccd2bac7bf121441e257044f5813e85180f (patch) | |
| tree | 795c33992f702be01aac2ffbfb652408168d9b26 /libs | |
| parent | 7c48707a9d320230452d5937239f28ab0ea2e695 (diff) | |
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 'libs')
| -rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 5 | ||||
| -rw-r--r-- | libs/gui/ISurfaceComposerClient.cpp | 3 | ||||
| -rw-r--r-- | libs/rs/driver/rsdRuntimeMath.cpp | 10 |
3 files changed, 6 insertions, 12 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index db3282781ab3..ca7c8f88e1ae 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -40,11 +40,6 @@ // --------------------------------------------------------------------------- -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) - -// --------------------------------------------------------------------------- - namespace android { class IDisplayEventConnection; diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp index ace16aaae47c..5ebdbd95587b 100644 --- a/libs/gui/ISurfaceComposerClient.cpp +++ b/libs/gui/ISurfaceComposerClient.cpp @@ -42,9 +42,6 @@ #define AID_GRAPHICS 1003 #endif -#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) -#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) - // --------------------------------------------------------------------------- namespace android { diff --git a/libs/rs/driver/rsdRuntimeMath.cpp b/libs/rs/driver/rsdRuntimeMath.cpp index d29da7e8f925..b927ed217b07 100644 --- a/libs/rs/driver/rsdRuntimeMath.cpp +++ b/libs/rs/driver/rsdRuntimeMath.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <cutils/compiler.h> + #include "rsContext.h" #include "rsScriptC.h" #include "rsMatrix4x4.h" @@ -306,7 +308,7 @@ static int32_t SC_AtomicSub(volatile int32_t *ptr, int32_t value) { do { prev = *ptr; status = android_atomic_release_cas(prev, prev - value, ptr); - } while (__builtin_expect(status != 0, 0)); + } while (CC_UNLIKELY(status != 0)); return prev; } @@ -323,7 +325,7 @@ static int32_t SC_AtomicXor(volatile int32_t *ptr, int32_t value) { do { prev = *ptr; status = android_atomic_release_cas(prev, prev ^ value, ptr); - } while (__builtin_expect(status != 0, 0)); + } while (CC_UNLIKELY(status != 0)); return prev; } @@ -333,7 +335,7 @@ static int32_t SC_AtomicMin(volatile int32_t *ptr, int32_t value) { prev = *ptr; int32_t n = rsMin(value, prev); status = android_atomic_release_cas(prev, n, ptr); - } while (__builtin_expect(status != 0, 0)); + } while (CC_UNLIKELY(status != 0)); return prev; } @@ -343,7 +345,7 @@ static int32_t SC_AtomicMax(volatile int32_t *ptr, int32_t value) { prev = *ptr; int32_t n = rsMax(value, prev); status = android_atomic_release_cas(prev, n, ptr); - } while (__builtin_expect(status != 0, 0)); + } while (CC_UNLIKELY(status != 0)); return prev; } |