qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/3] block/nvme: Initialize constant values with const_le32()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 1/3] block/nvme: Initialize constant values with const_le32()
Date: Thu, 17 Sep 2020 15:52:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/17/20 11:55 AM, Stefan Hajnoczi wrote:
> On Wed, Sep 16, 2020 at 10:40:02PM +0200, Philippe Mathieu-Daudé wrote:
>> To avoid multiple endianess conversion, as we know the device
>> registers are in little-endian, directly use const_le32() with
>> constant values.
> 
> Can cpu_to_X() be extended to handle constant expressions? That way the
> programmer doesn't need to remember the const_X() API exists.
> 
> Maybe __builtin_constant_p() can be used:
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fconstant_005fp

Yes it works! Good idea :)




reply via email to

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