From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB4yW-0004UT-12 for qemu-devel@nongnu.org; Thu, 09 Jun 2016 14:46:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB4yT-0008KI-Pp for qemu-devel@nongnu.org; Thu, 09 Jun 2016 14:46:39 -0400 Received: from mail-vk0-x22c.google.com ([2607:f8b0:400c:c05::22c]:34319) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB4yT-0008KD-LX for qemu-devel@nongnu.org; Thu, 09 Jun 2016 14:46:37 -0400 Received: by mail-vk0-x22c.google.com with SMTP id e4so67562344vkb.1 for ; Thu, 09 Jun 2016 11:46:37 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Thu, 9 Jun 2016 19:46:17 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v6 01/13] bitops: Add MAKE_64BIT_MASK macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis Cc: QEMU Developers , Peter Crosthwaite , Edgar Iglesias , "Edgar E. Iglesias" , =?UTF-8?Q?Andreas_F=C3=A4rber?= , =?UTF-8?B?S09OUkFEIEZyw6lkw6lyaWM=?= , =?UTF-8?B?QWxleCBCZW5uw6ll?= On 12 May 2016 at 23:45, Alistair Francis wro= te: > Add a macro that creates a 64bit value which has length number of ones > shifted acrros by the value of shift. "across" > > Signed-off-by: Alistair Francis > Reviewed-by: Alex Benn=C3=A9e > --- > V5: > - Re-write to a 64-bit mask instead of ONES() > - Re-order this patch in the series > > include/qemu/bitops.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h > index 755fdd1..3c45791 100644 > --- a/include/qemu/bitops.h > +++ b/include/qemu/bitops.h > @@ -24,6 +24,9 @@ > #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) > #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(= long)) > > +#define MAKE_64BIT_MASK(shift, length) \ > + (((1ull << (length)) - 1) << shift) > + This is undefined behaviour for a 64-bit length. The expression we use in deposit64() to create a mask is ((~0ULL >> (64 - length)) << start) thanks -- PMM