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: Philippe Mathieu-Daudé
Subject: Re: [PATCH 4/4] qemu/bswap: Remove <byteswap.h> dependency
Date: Wed, 23 Sep 2020 12:30:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/23/20 12:16 PM, Peter Maydell wrote:
> 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 ?

Yes, this is why I couldn't get ride of everything

After reading Paolo's suggestion to use qatomic*, I
am tempted to suggest qbswap* but I am still looking
for better alternatives...

> 
> thanks
> -- PMM
> 




reply via email to

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