Re: [PATCH v2 2/9] hw/vexpress.c: Remove forced cast to u64

Philippe Mathieu-Daudé <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 18/8/26 19:20, Peter Xu wrote:
> Now since ram_addr_t has switched to u64, remove the forced cast as not
> needed.
> 
> Suggested-by: Peter Maydell <[email protected]>
> Signed-off-by: Peter Xu <[email protected]>
> ---
>   hw/arm/vexpress.c | 13 +++----------
>   1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index f26d8c6f8d..a6ce426356 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -363,16 +363,9 @@ static void a15_daughterboard_init(VexpressMachineState *vms,
>       MachineState *machine = MACHINE(vms);
>       MemoryRegion *sysmem = get_system_memory();
>   
> -    {
> -        /* We have to use a separate 64 bit variable here to avoid the gcc
> -         * "comparison is always false due to limited range of data type"
> -         * warning if we are on a host where ram_addr_t is 32 bits.
> -         */
> -        uint64_t rsz = ram_size;
> -        if (rsz > (30ULL * 1024 * 1024 * 1024)) {
> -            error_report("vexpress-a15: cannot model more than 30GB RAM");
> -            exit(1);
> -        }
> +    if (ram_size > (30ULL * 1024 * 1024 * 1024)) {

Note we have a more readable GiB definition in "qemu/units.h":

   #define GiB     (INT64_C(1) << 30)

Regardless:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>

> +        error_report("vexpress-a15: cannot model more than 30GB RAM");
> +        exit(1);
>       }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.