diff --git a/CMakeLists.txt b/CMakeLists.txt index 56c71c88..e5e3097f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,12 @@ cmake_dependent_option( OFF ) +include(TestBigEndian) +test_big_endian(BIG_ENDIAN) +if(BIG_ENDIAN) + add_definitions("-DHS_BIG_ENDIAN") +endif() + set(CMAKE_C_FLAGS_DEBUG "-DDEBUG ${CMAKE_C_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG ${CMAKE_CXX_FLAGS_DEBUG}") if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR diff --git a/core/Stream/hsStream.cpp b/core/Stream/hsStream.cpp index 2728699b..28833fbd 100644 --- a/core/Stream/hsStream.cpp +++ b/core/Stream/hsStream.cpp @@ -54,7 +54,7 @@ uint16_t hsStream::readShort() void hsStream::readShorts(size_t count, uint16_t* buf) { read(sizeof(uint16_t) * count, buf); -#ifdef WORDS_BIGENDIAN +#ifdef HS_BIG_ENDIAN for (size_t i=0; i