Go to the documentation of this file.
25#ifndef GWENHYWFAR_ENDIANFNS_H
26#define GWENHYWFAR_ENDIANFNS_H
31#if GWENHYWFAR_SYS_IS_WINDOWS
33# define GWEN_ENDIAN_LE16TOH(x) (x)
34# define GWEN_ENDIAN_HTOLE16(x) (x)
36# define GWEN_ENDIAN_LE32TOH(x) (x)
37# define GWEN_ENDIAN_HTOLE32(x) (x)
39# define GWEN_ENDIAN_LE64TOH(x) (x)
40# define GWEN_ENDIAN_HTOLE64(x) (x)
42#elif defined(__APPLE__)
44#include <libkern/OSByteOrder.h>
46#define GWEN_ENDIAN_HTOLE16(x) OSSwapHostToLittleInt16(x)
47#define GWEN_ENDIAN_LE16TOH(x) OSSwapLittleToHostInt16(x)
49#define GWEN_ENDIAN_HTOLE32(x) OSSwapHostToLittleInt32(x)
50#define GWEN_ENDIAN_LE32TOH(x) OSSwapLittleToHostInt32(x)
52#define GWEN_ENDIAN_HTOLE64(x) OSSwapHostToLittleInt64(x)
53#define GWEN_ENDIAN_LE64TOH(x) OSSwapLittleToHostInt64(x)
55#define GWEN_ENDIAN_HTOBE16(x) OSSwapHostToBigInt16(x)
56#define GWEN_ENDIAN_BE16TOH(x) OSSwapBigToHostInt16(x)
58#define GWEN_ENDIAN_HTOBE32(x) OSSwapHostToBigInt32(x)
59#define GWEN_ENDIAN_BE32TOH(x) OSSwapBigToHostInt32(x)
61#define GWEN_ENDIAN_HTOBE64(x) OSSwapHostToBigInt64(x)
62#define GWEN_ENDIAN_BE64TOH(x) OSSwapBigToHostInt64(x)
68# define GWEN_ENDIAN_LE16TOH(x) le16toh(x)
69# define GWEN_ENDIAN_HTOLE16(x) htole16(x)
71# define GWEN_ENDIAN_LE32TOH(x) le32toh(x)
72# define GWEN_ENDIAN_HTOLE32(x) htole32(x)
74# define GWEN_ENDIAN_LE64TOH(x) le64toh(x)
75# define GWEN_ENDIAN_HTOLE64(x) htole64(x)