zmqpp
4.1.2
C++ bindings for 0mq (libzmq)
src
zmqpp
byte_ordering.hpp
Go to the documentation of this file.
1
/*
2
* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
*
6
* This file is part of zmqpp.
7
* Copyright (c) 2011-2015 Contributors as noted in the AUTHORS file.
8
*/
9
17
#pragma once
18
19
#if defined( __APPLE__)
// Byte ordering on OS X
20
21
#include <libkern/OSByteOrder.h>
22
#define HOST_TO_BIG_ENDIAN_32(x) OSSwapHostToBigInt32(x)
23
24
#elif defined(_WIN32)
// Byte ordering on Windows
25
26
#if BYTE_ORDER == LITTLE_ENDIAN
27
#include <winsock2.h>
28
#define HOST_TO_BIG_ENDIAN_32(x) htonl(x)
29
30
#elif BYTE_ORDER == BIG_ENDIAN
31
#define HOST_TO_BIG_ENDIAN_32(x) (x)
32
33
#endif
34
35
#else
// Let htobe32 be the default function
36
37
#include <endian.h>
38
#define HOST_TO_BIG_ENDIAN_32(x) htobe32(x)
39
40
#endif
41
42
// Cause a compiler error if the platform is not supported
43
#ifndef HOST_TO_BIG_ENDIAN_32
44
#error Platform not supported in byte_ordering.hpp
45
#endif
Generated on Wed Nov 1 2017 14:53:24 for zmqpp by
1.9.2