[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil()
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil() |
Date: |
Tue, 24 Feb 2015 14:09:43 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Peter Maydell <address@hidden> writes:
> 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.
Working around compiler bugs is a perfectly good reason to ull big
constants.
Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil(), Alexey Kardashevskiy, 2015/02/24