mirror of
https://github.com/boostorg/endian.git
synced 2025-08-01 21:44:31 +02:00
Fixes for older gcc. Fixes for big endian machines.
This commit is contained in:
@@ -169,10 +169,10 @@ namespace endian
|
|||||||
# ifdef BOOST_ENDIAN_NO_INTRINSICS
|
# ifdef BOOST_ENDIAN_NO_INTRINSICS
|
||||||
uint64_t step32, step16;
|
uint64_t step32, step16;
|
||||||
step32 = static_cast<uint64_t>(x) << 32 | static_cast<uint64_t>(x) >> 32;
|
step32 = static_cast<uint64_t>(x) << 32 | static_cast<uint64_t>(x) >> 32;
|
||||||
step16 = (step32 & 0x0000FFFF0000FFFF) << 16
|
step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16
|
||||||
| (step32 & 0xFFFF0000FFFF0000) >> 16;
|
| (step32 & 0xFFFF0000FFFF0000ULL) >> 16;
|
||||||
return static_cast<int64_t>((step16 & 0x00FF00FF00FF00FF) << 8
|
return static_cast<int64_t>((step16 & 0x00FF00FF00FF00FFULL) << 8
|
||||||
| (step16 & 0xFF00FF00FF00FF00) >> 8);
|
| (step16 & 0xFF00FF00FF00FF00ULL) >> 8);
|
||||||
# else
|
# else
|
||||||
return BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(static_cast<uint64_t>(x));
|
return BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(static_cast<uint64_t>(x));
|
||||||
# endif
|
# endif
|
||||||
@@ -206,10 +206,10 @@ namespace endian
|
|||||||
# ifdef BOOST_ENDIAN_NO_INTRINSICS
|
# ifdef BOOST_ENDIAN_NO_INTRINSICS
|
||||||
uint64_t step32, step16;
|
uint64_t step32, step16;
|
||||||
step32 = x << 32 | x >> 32;
|
step32 = x << 32 | x >> 32;
|
||||||
step16 = (step32 & 0x0000FFFF0000FFFF) << 16
|
step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16
|
||||||
| (step32 & 0xFFFF0000FFFF0000) >> 16;
|
| (step32 & 0xFFFF0000FFFF0000ULL) >> 16;
|
||||||
return (step16 & 0x00FF00FF00FF00FF) << 8
|
return (step16 & 0x00FF00FF00FF00FFULL) << 8
|
||||||
| (step16 & 0xFF00FF00FF00FF00) >> 8;
|
| (step16 & 0xFF00FF00FF00FF00ULL) >> 8;
|
||||||
# else
|
# else
|
||||||
return BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x);
|
return BOOST_ENDIAN_INTRINSIC_BYTE_SWAP_8(x);
|
||||||
# endif
|
# endif
|
||||||
@@ -406,7 +406,7 @@ namespace endian
|
|||||||
// Effects: none if native endian order is little, otherwise reverse(x)
|
// Effects: none if native endian order is little, otherwise reverse(x)
|
||||||
{
|
{
|
||||||
# ifndef BOOST_LITTLE_ENDIAN
|
# ifndef BOOST_LITTLE_ENDIAN
|
||||||
x = reverse(x);
|
reverse(x);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,4 +28,4 @@
|
|||||||
#define BOOST_ENDIAN_NO_INTRINSICS
|
#define BOOST_ENDIAN_NO_INTRINSICS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif BOOST_ENDIAN_INTRINSIC_HPP
|
#endif // BOOST_ENDIAN_INTRINSIC_HPP
|
||||||
|
Reference in New Issue
Block a user