mirror of
https://github.com/taglib/taglib.git
synced 2026-02-05 15:00:14 -05:00
Make use of the Boost Endian library for byte swapping.
It's likely to be better at choosing the most efficient method than our CMake tests.
This commit is contained in:
@ -31,10 +31,12 @@
|
||||
#ifndef DO_NOT_DOCUMENT // tell Doxygen not to document this header
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MSC_BYTESWAP)
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
# include <boost/endian/conversion.hpp>
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
# include <stdlib.h>
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
# include <byteswap.h>
|
||||
@ -59,7 +61,11 @@ namespace TagLib
|
||||
*/
|
||||
inline ushort byteSwap(ushort x)
|
||||
{
|
||||
#if defined(HAVE_GCC_BYTESWAP)
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
|
||||
return boost::endian::endian_reverse(x);
|
||||
|
||||
#elif defined(HAVE_GCC_BYTESWAP)
|
||||
|
||||
return __builtin_bswap16(x);
|
||||
|
||||
@ -91,7 +97,11 @@ namespace TagLib
|
||||
*/
|
||||
inline uint byteSwap(uint x)
|
||||
{
|
||||
#if defined(HAVE_GCC_BYTESWAP)
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
|
||||
return boost::endian::endian_reverse(x);
|
||||
|
||||
#elif defined(HAVE_GCC_BYTESWAP)
|
||||
|
||||
return __builtin_bswap32(x);
|
||||
|
||||
@ -126,7 +136,11 @@ namespace TagLib
|
||||
*/
|
||||
inline ulonglong byteSwap(ulonglong x)
|
||||
{
|
||||
#if defined(HAVE_GCC_BYTESWAP)
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
|
||||
return boost::endian::endian_reverse(x);
|
||||
|
||||
#elif defined(HAVE_GCC_BYTESWAP)
|
||||
|
||||
return __builtin_bswap64(x);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user