From e890cfa6be96a34779b5b8e51f109c18715b3af6 Mon Sep 17 00:00:00 2001 From: Jonathon Walz Date: Wed, 22 Nov 2017 19:36:30 -0600 Subject: [PATCH] Fix endian detection on Android (#18480) When compiling for Android, the preprocessor defines for byte order are are not included in the sys/param.h chain. By including sys/endian.h we we can ensure that the necessary macros are included. It is especially important that endian-ness is correctly detected as the node render order uses this information to sort #16262. Without this fix, nodes will be rendered in the incorrect order on 64-bit Android devices (on 32-bit, a different algorithm is used that is not sensitive to byte order). --- cocos/base/ccMacros.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cocos/base/ccMacros.h b/cocos/base/ccMacros.h index 6475f0abab..3a5352f023 100644 --- a/cocos/base/ccMacros.h +++ b/cocos/base/ccMacros.h @@ -296,6 +296,9 @@ CC_ASSERT(__gl_error_code == GL_NO_ERROR, "Error"); \ #endif #else #include + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + #include + #endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID #if ((defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)) #define CC_LITTLE_ENDIAN 1