#ifndef GS_UTIL_ENDIAN_H #define GS_UTIL_ENDIAN_H /* Copyright (c) 2013-2017 GomSpace A/S. All rights reserved. */ /** @file Detecting endian type. */ // generated by waf configure, defines either UTIL_BIG_ENDIAN or UTIL_LITTLE_ENDIAN #include #ifdef __cplusplus extern "C" { #endif #if !UTIL_BIG_ENDIAN && !UTIL_LITTLE_ENDIAN #error No endian defined #endif #if UTIL_BIG_ENDIAN && UTIL_LITTLE_ENDIAN #error Both big and little endian defined #endif #include /** Returns \a true if platform is big endian. */ static inline bool gs_endian_big(void) { #if (UTIL_BIG_ENDIAN) return true; #else return false; #endif } /** Returns \a true if platform is little endian. */ static inline bool gs_endian_little(void) { #if (UTIL_LITTLE_ENDIAN) return true; #else return false; #endif } #ifdef __cplusplus } #endif #endif