lsquic_byteswap.h revision 9626cfc2
1/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc.  See LICENSE. */
2#ifndef LSQUIC_BYTESWAP_H
3#define LSQUIC_BYTESWAP_H 1
4
5#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
6#include <sys/endian.h>
7#define bswap_16 bswap16
8#define bswap_32 bswap32
9#define bswap_64 bswap64
10#elif defined(__APPLE__)
11#include <libkern/OSByteOrder.h>
12#define bswap_16 OSSwapInt16
13#define bswap_32 OSSwapInt32
14#define bswap_64 OSSwapInt64
15#elif defined(WIN32)
16#define bswap_16 _byteswap_ushort
17#define bswap_32 _byteswap_ulong
18#define bswap_64 _byteswap_uint64
19#else
20#include <byteswap.h>
21#endif
22
23#endif
24