qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] Fix compilation of check-qint.c by using a l


From: Reimar Döffinger
Subject: Re: [Qemu-devel] [PATCH v2] Fix compilation of check-qint.c by using a long long integer constant
Date: Sat, 5 Sep 2009 10:07:25 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Sep 04, 2009 at 03:25:20PM -0300, Luiz Capitulino wrote:
> On Fri, 4 Sep 2009 19:56:30 +0200
> Pierre Riteau <address@hidden> wrote:
> 
> > 
> > On 4 sept. 09, at 19:29, Reimar Döffinger wrote:
> > 
> > > On Fri, Sep 04, 2009 at 07:09:58PM +0200, Pierre Riteau wrote:
> > >> Error was:
> > >> check-qint.c:46: error: integer constant is too large for 'long' type
> > >> ---
> > >> check-qint.c |    2 +-
> > >> 1 files changed, 1 insertions(+), 1 deletions(-)
> > >>
> > >> diff --git a/check-qint.c b/check-qint.c
> > >> index ae5d22f..f5c054e 100644
> > >> --- a/check-qint.c
> > >> +++ b/check-qint.c
> > >> @@ -43,7 +43,7 @@ END_TEST
> > >> START_TEST(qint_from_int64_test)
> > >> {
> > >>     QInt *qi;
> > >> -    const int64_t value = 0xffffffffffffffff;
> > >> +    const int64_t value = 0xffffffffffffffffLL;
> > >
> > > Hm, well it does not really fit in a signed long long either (so  
> > > from that
> > > aspect it should be ULL).
> > > Should it not be simply -1 (does qemu assume all architectures
> > > use two's complement?)?
> > 
> > 
> > How about INT64_MIN?
> 
>  The test is there to assure that QInt can handle
> integers > 32-bits, so it's not an issue if we have
> fewer bits.

For that this value is nonsense, this test could succeed even with a 32
bit QInt and sign expansion.
Not to mention that also a conversion to float and back would keep the
value unchanged, although it would lose information in the general case.
If it's supposed to test that it will really store 64 bit it should be
some random number with variation in both upper and lower bits.




reply via email to

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