21 lines
593 B
C
21 lines
593 B
C
// a) As Mac OS X does not have byteswap.h
|
|
// needed this for a c util I had used over the years on linux.
|
|
// did not find a solution to stopgap via macports, sadly, but this did the trick
|
|
|
|
#if HAVE_BYTESWAP_H
|
|
#include <byteswap.h>
|
|
#else
|
|
#define bswap_16(value) \
|
|
((((value) & 0xff) << 8) | ((value) >> 8))
|
|
|
|
#define bswap_32(value) \
|
|
(((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
|
|
(uint32_t)bswap_16((uint16_t)((value) >> 16)))
|
|
|
|
#define bswap_64(value) \
|
|
(((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
|
|
<< 32) | \
|
|
(uint64_t)bswap_32((uint32_t)((value) >> 32)))
|
|
#endif
|
|
|