fixed bug undefining LIKELY/UNLIKELY in math lib
Bug: 36275627
Test: Built and check the surfaceflinger compiled
Change-Id: I062b8c0db540443635ac746824edb295190235d0
diff --git a/libs/math/include/math/TMatHelpers.h b/libs/math/include/math/TMatHelpers.h
index 478e702..5cb725d 100644
--- a/libs/math/include/math/TMatHelpers.h
+++ b/libs/math/include/math/TMatHelpers.h
@@ -30,6 +30,8 @@
#include <utils/String8.h>
+#ifndef LIKELY
+#define LIKELY_DEFINED_LOCAL
#ifdef __cplusplus
# define LIKELY( exp ) (__builtin_expect( !!(exp), true ))
# define UNLIKELY( exp ) (__builtin_expect( !!(exp), false ))
@@ -37,6 +39,7 @@
# define LIKELY( exp ) (__builtin_expect( !!(exp), 1 ))
# define UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 ))
#endif
+#endif
#define PURE __attribute__((pure))
@@ -631,7 +634,11 @@
} // namespace details
} // namespace android
+#ifdef LIKELY_DEFINED_LOCAL
+#undef LIKELY_DEFINED_LOCAL
#undef LIKELY
#undef UNLIKELY
+#endif //LIKELY_DEFINED_LOCAL
+
#undef PURE
#undef CONSTEXPR
diff --git a/libs/math/include/math/half.h b/libs/math/include/math/half.h
index ef1e45f..615b840 100644
--- a/libs/math/include/math/half.h
+++ b/libs/math/include/math/half.h
@@ -22,6 +22,7 @@
#include <type_traits>
#ifndef LIKELY
+#define LIKELY_DEFINED_LOCAL
#ifdef __cplusplus
# define LIKELY( exp ) (__builtin_expect( !!(exp), true ))
# define UNLIKELY( exp ) (__builtin_expect( !!(exp), false ))
@@ -202,6 +203,10 @@
} // namespace std
+#ifdef LIKELY_DEFINED_LOCAL
+#undef LIKELY_DEFINED_LOCAL
#undef LIKELY
#undef UNLIKELY
+#endif // LIKELY_DEFINED_LOCAL
+
#undef CONSTEXPR