[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil()

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil()
Date: Tue, 24 Feb 2015 20:39:43 +0900

On 24 February 2015 at 18:39, Markus Armbruster <address@hidden> wrote:
> Eric Blake <address@hidden> writes:
>> Because 0x8000000000000000u is only required to be a 'long', and on
>> 32-bit machines, your constant would overflow long.  See, for example,
>> commit 5cb6be2ca.  You NEED the 'll' suffix to ensure that the compiler
>> doesn't reject the constant as an overflow.
> Not true.

You need ULL because certain versions of gcc will warn if you do
not. (I have a feeling this includes the elderly gcc I currently
use for mingw builds.) You could argue that this is a gcc bug, and
somebody probably did given that newer gcc don't warn about this.
However we should always use ULL (or LL) for 64-bit constants,
to avoid confusing those versions of gcc.

-- PMM

reply via email to

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