1 #ifndef COMPAT_H 2 #define COMPAT_H 3 4 #ifdef HAVE_BYTESWAP_H 5 # include <byteswap.h> 6 #else 7 /* Given an unsigned 16-bit argument X, return the value corresponding to 8 X with reversed byte order. */ 9 # define bswap_16(x) ((((x) & 0x00FF) << 8) | \ 10 (((x) & 0xFF00) >> 8)) 11 12 /* Given an unsigned 32-bit argument X, return the value corresponding to 13 X with reversed byte order. */ 14 # define bswap_32(x) ((((x) & 0x000000FF) << 24) | \ 15 (((x) & 0x0000FF00) << 8) | \ 16 (((x) & 0x00FF0000) >> 8) | \ 17 (((x) & 0xFF000000) >> 24)) 18 #endif 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #ifndef HAVE_STRCASESTR 25 char *strcasestr (const char *haystack, const char *needle); 26 #endif 27 28 #ifndef HAVE_STRERROR_R 29 int strerror_r (int errnum, char *buf, size_t n); 30 #endif 31 32 void compat_cleanup (); 33 34 #ifdef __cplusplus 35 } 36 #endif 37 38 #endif 39