qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calc


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calculations
Date: Fri, 6 Nov 2015 17:33:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


On 06/11/2015 09:36, Pierre Morel wrote:
> The calculation are not broken and it works for actual usage

Thanks for confirming.

> For me, it is the design that is broken, as it uses an integer to represent
> something that is fundamentally unsigned like the size of a memory area.

But it uses a very large integer. :)

Consider that every time you do math on uint16_t, C is actually using a
32-bit signed integer.  This is roughly the same.

> This leads to have UINT64_MAX represented with {1, 0} instead of {0,
> UINT64_MAX}
> while {1, 0} is 2^64.
> This again leads to have unnecessary and obfuscating transformations
> with int128_2_64()
> to test for UINT64_MAX and return {1,0} in memory_region_init() while using
> inverse translation test{1,0} and return UINT64_MAX in memory_region_size()

Yes, the use of UINT64_MAX for 2^64 is a hack, but it is unrelated to
the signedness of Int128.

Paolo



reply via email to

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