2013-04-16 23:57:28 -04:00
|
|
|
#ifndef _TOKU_HTONL_H
|
|
|
|
#define _TOKU_HTONL_H
|
|
|
|
|
2013-04-16 23:58:59 -04:00
|
|
|
#if !TOKU_WINDOWS
|
2013-04-16 23:57:28 -04:00
|
|
|
#error
|
|
|
|
#endif
|
|
|
|
|
2013-04-16 23:57:29 -04:00
|
|
|
#if defined(__cplusplus)
|
2013-04-16 23:57:28 -04:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__INTEL_COMPILER)
|
|
|
|
|
|
|
|
// assume endian == LITTLE_ENDIAN
|
|
|
|
|
|
|
|
static inline uint32_t toku_htonl(uint32_t i) {
|
|
|
|
return _bswap(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t toku_ntohl(uint32_t i) {
|
|
|
|
return _bswap(i);
|
|
|
|
}
|
|
|
|
|
2013-04-16 23:57:46 -04:00
|
|
|
#elif defined(_MSVC_VER)
|
2013-04-16 23:57:28 -04:00
|
|
|
#include <winsock.h>
|
|
|
|
|
|
|
|
static inline uint32_t toku_htonl(uint32_t i) {
|
|
|
|
return htonl(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t toku_ntohl(uint32_t i) {
|
|
|
|
return ntonl(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-04-16 23:57:29 -04:00
|
|
|
#if defined(__cplusplus)
|
2013-04-16 23:57:28 -04:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|