Alexander Afanasyev | 13bb51a | 2014-01-02 19:13:26 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 2 | /** |
| 3 | * Copyright (c) 2013-2014, Regents of the University of California. |
| 4 | * All rights reserved. |
Alexander Afanasyev | 13bb51a | 2014-01-02 19:13:26 -0800 | [diff] [blame] | 5 | * |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 6 | * 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 Afanasyev | 13bb51a | 2014-01-02 19:13:26 -0800 | [diff] [blame] | 8 | * |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 9 | * 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 Afanasyev | 13bb51a | 2014-01-02 19:13:26 -0800 | [diff] [blame] | 13 | */ |
| 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 |