[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 08/10] qemu/bswap: Add const_le64()
From: |
Fan Ni |
Subject: |
Re: [PATCH v4 08/10] qemu/bswap: Add const_le64() |
Date: |
Tue, 28 Feb 2023 04:14:18 +0000 |
On Mon, Feb 06, 2023 at 05:28:14PM +0000, Jonathan Cameron wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> Gcc requires constant versions of cpu_to_le* calls.
>
> Add a 64 bit version.
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Gregory Price <gregory.price@memverge.com>
> Tested-by: Gregory Price <gregory.price@memverge.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> ---
> v2: Update comment (Philippe)
> ---
> include/qemu/bswap.h | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
> index 3cbe52246b..eb3bcf2520 100644
> --- a/include/qemu/bswap.h
> +++ b/include/qemu/bswap.h
> @@ -129,11 +129,20 @@ CPU_CONVERT(le, 32, uint32_t)
> CPU_CONVERT(le, 64, uint64_t)
>
> /*
> - * Same as cpu_to_le{16,32}, except that gcc will figure the result is
> + * Same as cpu_to_le{16,32,64}, except that gcc will figure the result is
> * a compile-time constant if you pass in a constant. So this can be
> * used to initialize static variables.
> */
> #if HOST_BIG_ENDIAN
> +# define const_le64(_x) \
> + ((((_x) & 0x00000000000000ffU) << 56) | \
> + (((_x) & 0x000000000000ff00U) << 40) | \
> + (((_x) & 0x0000000000ff0000U) << 24) | \
> + (((_x) & 0x00000000ff000000U) << 8) | \
> + (((_x) & 0x000000ff00000000U) >> 8) | \
> + (((_x) & 0x0000ff0000000000U) >> 24) | \
> + (((_x) & 0x00ff000000000000U) >> 40) | \
> + (((_x) & 0xff00000000000000U) >> 56))
> # define const_le32(_x) \
> ((((_x) & 0x000000ffU) << 24) | \
> (((_x) & 0x0000ff00U) << 8) | \
> @@ -143,6 +152,7 @@ CPU_CONVERT(le, 64, uint64_t)
> ((((_x) & 0x00ff) << 8) | \
> (((_x) & 0xff00) >> 8))
> #else
> +# define const_le64(_x) (_x)
> # define const_le32(_x) (_x)
> # define const_le16(_x) (_x)
> #endif
> --
> 2.37.2
>
>
- Re: [PATCH v4 03/10] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL, (continued)
[PATCH v4 04/10] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition, Jonathan Cameron, 2023/02/06
[PATCH v4 05/10] tests/acpi: Allow update of q35/DSDT.cxl, Jonathan Cameron, 2023/02/06
[PATCH v4 06/10] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge, Jonathan Cameron, 2023/02/06
[PATCH v4 07/10] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID, Jonathan Cameron, 2023/02/06
[PATCH v4 08/10] qemu/bswap: Add const_le64(), Jonathan Cameron, 2023/02/06
- Message not available
- Re: [PATCH v4 08/10] qemu/bswap: Add const_le64(),
Fan Ni <=
[PATCH v4 09/10] qemu/uuid: Add UUID static initializer, Jonathan Cameron, 2023/02/06
[PATCH v4 10/10] hw/cxl/mailbox: Use new UUID network order define for cel_uuid, Jonathan Cameron, 2023/02/06