[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 31/55] include/qemu/int128.h: Add function to create Int128 f
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 31/55] include/qemu/int128.h: Add function to create Int128 from int64_t |
Date: |
Tue, 8 Jun 2021 08:45:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 6/7/21 6:57 PM, Peter Maydell wrote:
> int128_make64() creates an Int128 from an unsigned 64 bit value; add
> a function int128_makes64() creating an Int128 from a signed 64 bit
> value.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> include/qemu/int128.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/include/qemu/int128.h b/include/qemu/int128.h
> index 52fc2384211..64500385e37 100644
> --- a/include/qemu/int128.h
> +++ b/include/qemu/int128.h
> @@ -11,6 +11,11 @@ static inline Int128 int128_make64(uint64_t a)
> return a;
> }
> +static inline Int128 int128_makes64(int64_t a)
> +{
> + return (Int128) { a, a >> 63 };
This file would be easier to review using explicit field names:
return (Int128) { .lo = a, .hi = a >> 63 };
Also, maybe we could rename int128_makeX -> int128_make_uX
before introducing int128_make_sX.
Regardless:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> +}
> +
> static inline Int128 int128_make128(uint64_t lo, uint64_t hi)
> {
> return (Int128) { lo, hi };
>
- [PATCH 15/55] bitops.h: Provide hswap32(), hswap64(), wswap64() swapping operations, (continued)
- [PATCH 15/55] bitops.h: Provide hswap32(), hswap64(), wswap64() swapping operations, Peter Maydell, 2021/06/07
- [PATCH 26/55] target/arm: Implement MVE VABD, Peter Maydell, 2021/06/07
- [PATCH 24/55] target/arm: Implement MVE VRMULH, Peter Maydell, 2021/06/07
- [PATCH 39/55] target/arm: Implement MVE VQDMULH and VQRDMULH (scalar), Peter Maydell, 2021/06/07
- [PATCH 31/55] include/qemu/int128.h: Add function to create Int128 from int64_t, Peter Maydell, 2021/06/07
- [PATCH 36/55] target/arm: Implement MVE VBRSR, Peter Maydell, 2021/06/07
- [PATCH 40/55] target/arm: Implement MVE VQDMULL scalar, Peter Maydell, 2021/06/07
- [PATCH 38/55] target/arm: Implement MVE VQADD and VQSUB, Peter Maydell, 2021/06/07
- [PATCH 34/55] target/arm: Implement MVE VSUB, VMUL (scalar), Peter Maydell, 2021/06/07
- [PATCH 23/55] target/arm: Implement MVE VMULH, Peter Maydell, 2021/06/07