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
diff --git a/libs/rs/driver/rsdRuntimeMath.cpp b/libs/rs/driver/rsdRuntimeMath.cpp
index d29da7e..b927ed2 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 @@
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 @@
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 @@
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 @@
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;
}