diff --git a/include/bitops.h b/include/bitops.h index 287d4af29..72274de0b 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -20,6 +20,12 @@ # include #endif +#if !(defined(HAVE_BYTESWAP_H) && defined(HAVE_ENDIAN_H)) +/* + * When both byteswap.h and endian.h are preseent, the proper macros are defined + * as those files are glibc compatible. Otherwise, compensate for the slightly + * different interfaces between the different BSDs. + */ #if defined(__OpenBSD__) # include # define be16toh(x) betoh16(x) @@ -47,6 +53,7 @@ # define bswap_32(x) OSSwapInt32(x) # define bswap_64(x) OSSwapInt64(x) #endif +#endif /* * Fallbacks