lsquic_byteswap.h revision 229fce07
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 29626cfc2SDmitri Tikhonov#ifndef LSQUIC_BYTESWAP_H 39626cfc2SDmitri Tikhonov#define LSQUIC_BYTESWAP_H 1 49626cfc2SDmitri Tikhonov 59626cfc2SDmitri Tikhonov#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) 69626cfc2SDmitri Tikhonov#include <sys/endian.h> 79626cfc2SDmitri Tikhonov#define bswap_16 bswap16 89626cfc2SDmitri Tikhonov#define bswap_32 bswap32 99626cfc2SDmitri Tikhonov#define bswap_64 bswap64 109626cfc2SDmitri Tikhonov#elif defined(__APPLE__) 119626cfc2SDmitri Tikhonov#include <libkern/OSByteOrder.h> 129626cfc2SDmitri Tikhonov#define bswap_16 OSSwapInt16 139626cfc2SDmitri Tikhonov#define bswap_32 OSSwapInt32 149626cfc2SDmitri Tikhonov#define bswap_64 OSSwapInt64 159626cfc2SDmitri Tikhonov#elif defined(WIN32) 169626cfc2SDmitri Tikhonov#define bswap_16 _byteswap_ushort 179626cfc2SDmitri Tikhonov#define bswap_32 _byteswap_ulong 189626cfc2SDmitri Tikhonov#define bswap_64 _byteswap_uint64 199626cfc2SDmitri Tikhonov#else 209626cfc2SDmitri Tikhonov#include <byteswap.h> 219626cfc2SDmitri Tikhonov#endif 229626cfc2SDmitri Tikhonov 239626cfc2SDmitri Tikhonov#endif 24