blob: 5329112562f4d1fe0ab45f6f248d3bc105122b92 [file] [log] [blame]
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07002/**
3 * Copyright (c) 2013-2014, Regents of the University of California.
4 * All rights reserved.
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -08005 *
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
7 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -08008 *
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07009 * This file licensed under New BSD License. See COPYING for detailed information about
10 * ndn-cxx library copyright, permissions, and redistribution restrictions.
11 *
12 * @author Junxiao Shi <http://www.cs.arizona.edu/people/shijunxiao/>
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080013 */
14
15#ifdef __linux__
16
17#include <endian.h>
18
19#endif
20
21#ifdef __FreeBSD__
22
23#include <sys/endian.h>
24
25#endif
26
27#ifdef __APPLE__
28
29#include <libkern/OSByteOrder.h>
30#define htobe16(x) OSSwapHostToBigInt16(x)
31#define htole16(x) OSSwapHostToLittleInt16(x)
32#define be16toh(x) OSSwapBigToHostInt16(x)
33#define le16toh(x) OSSwapLittleToHostInt16(x)
34#define htobe32(x) OSSwapHostToBigInt32(x)
35#define htole32(x) OSSwapHostToLittleInt32(x)
36#define be32toh(x) OSSwapBigToHostInt32(x)
37#define le32toh(x) OSSwapLittleToHostInt32(x)
38#define htobe64(x) OSSwapHostToBigInt64(x)
39#define htole64(x) OSSwapHostToLittleInt64(x)
40#define be64toh(x) OSSwapBigToHostInt64(x)
41#define le64toh(x) OSSwapLittleToHostInt64(x)
42
43#endif