From 2f6dba3ab690eecf1daa947f9aa028bfbc412d49 Mon Sep 17 00:00:00 2001 From: Beman Date: Mon, 13 May 2013 10:09:25 -0400 Subject: [PATCH] Fixes for older gcc. Fixes for big endian machines. --- include/boost/endian/converters.hpp | 18 +++++++++--------- include/boost/endian/detail/intrinsic.hpp | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/boost/endian/converters.hpp b/include/boost/endian/converters.hpp index 638c253..b4ff033 100644 --- a/include/boost/endian/converters.hpp +++ b/include/boost/endian/converters.hpp @@ -169,10 +169,10 @@ namespace endian # ifdef BOOST_ENDIAN_NO_INTRINSICS uint64_t step32, step16; step32 = static_cast(x) << 32 | static_cast(x) >> 32; - step16 = (step32 & 0x0000FFFF0000FFFF) << 16 - | (step32 & 0xFFFF0000FFFF0000) >> 16; - return static_cast((step16 & 0x00FF00FF00FF00FF) << 8 - | (step16 & 0xFF00FF00FF00FF00) >> 8); + step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16 + | (step32 & 0xFFFF0000FFFF0000ULL) >> 16; + return static_cast((step16 & 0x00FF00FF00FF00FFULL) << 8 + | (step16 & 0xFF00FF00FF00FF00ULL) >> 8); # else return BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(static_cast(x)); # endif @@ -206,10 +206,10 @@ namespace endian # ifdef BOOST_ENDIAN_NO_INTRINSICS uint64_t step32, step16; step32 = x << 32 | x >> 32; - step16 = (step32 & 0x0000FFFF0000FFFF) << 16 - | (step32 & 0xFFFF0000FFFF0000) >> 16; - return (step16 & 0x00FF00FF00FF00FF) << 8 - | (step16 & 0xFF00FF00FF00FF00) >> 8; + step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16 + | (step32 & 0xFFFF0000FFFF0000ULL) >> 16; + return (step16 & 0x00FF00FF00FF00FFULL) << 8 + | (step16 & 0xFF00FF00FF00FF00ULL) >> 8; # else return BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x); # endif @@ -406,7 +406,7 @@ namespace endian // Effects: none if native endian order is little, otherwise reverse(x) { # ifndef BOOST_LITTLE_ENDIAN - x = reverse(x); + reverse(x); # endif } diff --git a/include/boost/endian/detail/intrinsic.hpp b/include/boost/endian/detail/intrinsic.hpp index 921ae2c..8cc4a91 100644 --- a/include/boost/endian/detail/intrinsic.hpp +++ b/include/boost/endian/detail/intrinsic.hpp @@ -28,4 +28,4 @@ #define BOOST_ENDIAN_NO_INTRINSICS #endif -#endif BOOST_ENDIAN_INTRINSIC_HPP +#endif // BOOST_ENDIAN_INTRINSIC_HPP