[vlc-devel] [PATCH] include: Rename the bswap functions to vlc_bswap
Rémi Denis-Courmont
remi at remlab.net
Mon Mar 5 18:09:06 CET 2018
Le maanantaina 5. maaliskuuta 2018, 15.43.47 EET Kamil Rytarowski a écrit :
> The bswap16, bswap32 and bswap64 functions are already present on NetBSD
> and cannot be redefined in include/vlc_common.h as this causes fatal build
> errors.
>
> Rename these functions to vlc_bswap16, vlc_bswap32 and vlc_bswap64 and
> keep them as they are without fallback to the NetBSD's libc one. These
> functions are already small enough and we can bear with them as duplicates
> on the gain of no extra ifdefs in the vlc_common.h public header.
> ---
> include/vlc_common.h | 24 ++++++++++++------------
> modules/codec/araw.c | 10 +++++-----
> modules/codec/jpeg.c | 8 ++++----
> modules/codec/lpcm.c | 6 +++---
> modules/demux/avformat/demux.c | 2 +-
> modules/demux/ogg.c | 2 +-
> 6 files changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index d6a5c43b7b..30a8f32b67 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -754,14 +754,14 @@ VLC_USED static inline int vlc_popcount(unsigned long
> long x)
>
> /** Byte swap (16 bits) */
> VLC_USED
> -static inline uint16_t (bswap16)(uint16_t x)
> +static inline uint16_t (vlc_bswap16)(uint16_t x)
> {
> return (x << 8) | (x >> 8);
> }
>
> /** Byte swap (32 bits) */
> VLC_USED
> -static inline uint32_t (bswap32)(uint32_t x)
> +static inline uint32_t (vlc_bswap32)(uint32_t x)
> {
> #if defined (__GNUC__) || defined(__clang__)
> return __builtin_bswap32 (x);
> @@ -775,7 +775,7 @@ static inline uint32_t (bswap32)(uint32_t x)
>
> /** Byte swap (64 bits) */
> VLC_USED
> -static inline uint64_t (bswap64)(uint64_t x)
> +static inline uint64_t (vlc_bswap64)(uint64_t x)
> {
> #if defined (__GNUC__) || defined(__clang__)
> return __builtin_bswap64 (x);
The parenthesises become totally useless then.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list