diff options
author | japm48 <japm48@users.noreply.github.com> | 2020-04-02 16:32:20 +0200 |
---|---|---|
committer | Michael Dickens <michael.dickens@ettus.com> | 2020-04-06 12:46:24 -0400 |
commit | b65bcdeac505761e69019895f53a072a3ec3dcd8 (patch) | |
tree | 6e76a7560eccebd5c6a26d54885aa328da29c6ab | |
parent | 16a80b2815c9adff636d36836eb3d4df13fd97eb (diff) |
replace boost endian check with cmake
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | gr-audio/lib/osx/osx_common.h | 3 | ||||
-rw-r--r-- | gr-blocks/lib/wavfile.cc | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 79e829132a..200a07f11a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,6 +168,12 @@ include(CMakeOverloads) ######################################################################## include(GrMiscUtils) #compiler flag check +include(TestBigEndian) +TEST_BIG_ENDIAN(GR_IS_BIG_ENDIAN) +if(GR_IS_BIG_ENDIAN) + add_definitions(-DGR_IS_BIG_ENDIAN) +endif(GR_IS_BIG_ENDIAN) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(NOT WIN32) diff --git a/gr-audio/lib/osx/osx_common.h b/gr-audio/lib/osx/osx_common.h index 60e43a15f6..e313ae34fa 100644 --- a/gr-audio/lib/osx/osx_common.h +++ b/gr-audio/lib/osx/osx_common.h @@ -48,8 +48,7 @@ namespace osx { GR_LOG_WARN(d_logger, boost::format(" %s:%d") % __FILE__ % __LINE__); \ } -#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN -#ifdef BOOST_BIG_ENDIAN +#ifdef GR_IS_BIG_ENDIAN #define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian #else #define GR_PCM_ENDIANNESS 0 diff --git a/gr-blocks/lib/wavfile.cc b/gr-blocks/lib/wavfile.cc index 2160accddc..d3015f75b8 100644 --- a/gr-blocks/lib/wavfile.cc +++ b/gr-blocks/lib/wavfile.cc @@ -14,7 +14,6 @@ #include <gnuradio/blocks/wavfile.h> #include <stdint.h> -#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN #include <cstring> namespace gr { @@ -23,7 +22,7 @@ namespace blocks { // Basically, this is the opposite of htonx() and ntohx() // Define host to/from worknet (little endian) short and long -#ifdef BOOST_BIG_ENDIAN +#ifdef GR_IS_BIG_ENDIAN static inline uint16_t __gri_wav_bs16(uint16_t x) { return (x >> 8) | (x << 8); } @@ -45,7 +44,7 @@ static inline uint32_t __gri_wav_bs32(uint32_t x) #define htows(x) uint16_t(x) #define wtohs(x) uint16_t(x) -#endif // BOOST_BIG_ENDIAN +#endif // GR_IS_BIG_ENDIAN // WAV files are always little-endian, so we need some byte switching macros static inline uint32_t host_to_wav(uint32_t x) { return htowl(x); } |