qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] qemu/bswap: Remove <byteswap.h> dependency


From: Peter Maydell
Subject: Re: [PATCH 4/4] qemu/bswap: Remove <byteswap.h> dependency
Date: Wed, 23 Sep 2020 11:16:14 +0100

On Wed, 23 Sep 2020 at 11:09, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> All our supported compilers provide the __builtin_bswap()
> functions. Drop the <byteswap.h> dependency.
>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
> index 6875e48d617..c192a6ad3e7 100644
> --- a/include/qemu/bswap.h
> +++ b/include/qemu/bswap.h
> @@ -10,23 +10,6 @@
>  # include <sys/endian.h>
>  #elif defined(__HAIKU__)
>  # include <endian.h>
> -#elif defined(CONFIG_BYTESWAP_H)
> -# include <byteswap.h>
> -
> -static inline uint16_t bswap16(uint16_t x)
> -{
> -    return bswap_16(x);
> -}
> -
> -static inline uint32_t bswap32(uint32_t x)
> -{
> -    return bswap_32(x);
> -}
> -
> -static inline uint64_t bswap64(uint64_t x)
> -{
> -    return bswap_64(x);
> -}
>  #else
>  # define bswap16(_x) __builtin_bswap16(_x)
>  # define bswap32(_x) __builtin_bswap32(_x)

I suppose if we wanted to just use the __builtin_bswap*
implementation on all hosts (ie drop the special casing
of CONFIG_MACHINE_BSWAP_H/FreeBSD/Haiku) we'd need to
rename our macros to avoid potential conflicts with the
versions in the system headers there in case they were
pulled in via some other path ?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]