Received: from eggs.gnu.org ([2001:4830:134:3::10]:50716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFFI-00061X-OC for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:09:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQFFF-0008NW-Hi for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:09:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQFFF-0008KE-Al for qemu-devel@nongnu.org; Tue, 24 Feb 2015 08:09:49 -0500 From: Markus Armbruster References: <1424694237-22786-1-git-send-email-aik@ozlabs.ru> <877fv8sp97.fsf@blackfin.pond.sub.org> <54EB52AE.4030002@redhat.com> <87sidwo7a7.fsf@blackfin.pond.sub.org> <54EB9992.20601@redhat.com> <87fv9vlkb5.fsf@blackfin.pond.sub.org> Date: Tue, 24 Feb 2015 14:09:43 +0100 In-Reply-To: (Peter Maydell's message of "Tue, 24 Feb 2015 20:39:43 +0900") Message-ID: <87h9ubihgo.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2] utils: Add pow2ceil() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Alexey Kardashevskiy , QEMU Developers Peter Maydell writes: > On 24 February 2015 at 18:39, Markus Armbruster wrote: >> Eric Blake 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.