[FFmpeg-devel] [PATCH 3/4] Check for bswap_64 definition even though byteswap.h is present.
Måns Rullgård
mans
Fri Oct 3 00:57:21 CEST 2008
Diego 'Flameeyes' Petten? <flameeyes at gmail.com> writes:
> Since glibc only defines bswap_64 for GCC 2 or later, it doesn't get
> defined for the Sun Studio Compiler. In that case check if bswap_64
> was defined, and if it wasn't, define it.
> ---
>
> libavutil/bswap.h | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavutil/bswap.h b/libavutil/bswap.h
> index 798e857..cb6c418 100644
> --- a/libavutil/bswap.h
> +++ b/libavutil/bswap.h
> @@ -87,6 +87,9 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
> return x;
> }
>
> +#endif /* !HAVE_BYTESWAP_H */
> +
> +#ifndef bswap_64
> static inline uint64_t av_const bswap_64(uint64_t x)
> {
> #if 0
> @@ -107,8 +110,7 @@ static inline uint64_t av_const bswap_64(uint64_t x)
> return r.ll;
> #endif
> }
bswap_64() doesn't have to be a macro. Thus checking for it with
#ifdef is not safe.
> -#endif /* !HAVE_BYTESWAP_H */
> +#endif /* ndef bswap_64 */
I would be in favour of ignoring the non-standard byteswap.h entirely,
and always using our functions. Even if a byteswap.h exists, there is
no telling what it might contain, and our functions are at least as
good as glibc's anyway.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list