diff --git a/CMakeLists.txt b/CMakeLists.txt index 93dead6..b7b69f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,7 @@ endif() ############################################################################### include(${PROJECT_SOURCE_DIR}/cmake/dev/check_configuration.cmake) -option(CHECK_ENDIANNESS "Enable/disable endiannes checking" OFF) +option(CHECK_ENDIANNESS "Enable/disable endiannes checking" ON) if(CHECK_ENDIANNESS) check_endianness() else() diff --git a/cmake/dev/check_configuration.cmake b/cmake/dev/check_configuration.cmake index d662811..118fb9a 100644 --- a/cmake/dev/check_configuration.cmake +++ b/cmake/dev/check_configuration.cmake @@ -48,6 +48,11 @@ macro(check_endianness) # Test endianness include(TestBigEndian) test_big_endian(BIG_ENDIAN) + if(BIG_ENDIAN) + message(STATUS "Machine: big endian") + else() + message(STATUS "Machine: little endian") + endif() set(__BIG_ENDIAN__ ${BIG_ENDIAN}) endmacro() diff --git a/include/microcdr/microcdr.h b/include/microcdr/microcdr.h index bf06fe8..c0fe168 100644 --- a/include/microcdr/microcdr.h +++ b/include/microcdr/microcdr.h @@ -17,7 +17,8 @@ extern "C" typedef enum Endianness { - BIG_ENDIANNESS, LITTLE_ENDIANNESS + BIG_ENDIANNESS, + LITTLE_ENDIANNESS } Endianness; diff --git a/src/c/microcdr.c b/src/c/microcdr.c index a5b0d0f..0b678da 100644 --- a/src/c/microcdr.c +++ b/src/c/microcdr.c @@ -3,11 +3,7 @@ #include #include -#ifdef __BIG_ENDIAN__ -#define MACHINE_ENDIANNESS BIG_ENDIANNESS -#else -#define MACHINE_ENDIANNESS LITTLE_ENDIANNESS -#endif +#define MACHINE_ENDIANNESS !__BIG_ENDIAN__ // ------------------------------------------------------------------- // INTERNAL SERIALIZATION FUNCTIONS