lsquic_byteswap.h revision 2d296031
1/* Copyright (c) 2017 - 2019 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#include <stdlib.h>
17#define bswap_16 _byteswap_ushort
18#define bswap_32 _byteswap_ulong
19#define bswap_64 _byteswap_uint64
20#else
21#include <byteswap.h>
22#endif
23
24#endif
25