endian: MacOS X support for endian conversion macros

betohX/htobeX are only available on GNU/Linux.  This change introduces a
header file that maps these functions to the ones available on MacOS X.
This commit is contained in:
David Holm 2014-12-01 21:19:18 +01:00
parent e60e671ffd
commit 9880653e0f
4 changed files with 18 additions and 0 deletions

15
include/gsm/endian.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef GSM_ENDIAN_H
#define GSM_ENDIAN_H
#if defined(__linux__)
# include <endian.h>
#elif defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# define htobe16(x) OSSwapHostToBigInt16(x)
# define htobe32(x) OSSwapHostToBigInt32(x)
# define be32toh(x) OSSwapBigToHostInt32(x)
#endif
#endif /* GSM_ENDIAN_H */

View File

@ -23,6 +23,7 @@
#endif
#include <gnuradio/io_signature.h>
#include <gsm/endian.h>
#include <gsm/gsmtap.h>
#include "get_bcch_or_ccch_bursts_impl.h"

View File

@ -24,6 +24,7 @@
#include <gnuradio/io_signature.h>
#include "universal_ctrl_chans_demapper_impl.h"
#include <gsm/endian.h>
#include <gsm/gsmtap.h>
namespace gr {

View File

@ -38,6 +38,7 @@
#include <iomanip>
#include <assert.h>
#include <boost/scoped_ptr.hpp>
#include <gsm/endian.h>
//files included for debuging
//#include "plotting/plotting.hpp"