From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKXuP-0004cb-HG for qemu-devel@nongnu.org; Wed, 29 Jul 2015 16:25:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKXuK-0002Zs-Ng for qemu-devel@nongnu.org; Wed, 29 Jul 2015 16:25:01 -0400 Received: from mail-bn1bon0064.outbound.protection.outlook.com ([157.56.111.64]:11168 helo=na01-bn1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKXuK-0002ZS-Hx for qemu-devel@nongnu.org; Wed, 29 Jul 2015 16:24:56 -0400 From: Alistair Francis Date: Wed, 29 Jul 2015 13:24:51 -0700 Message-ID: <38fc8985bc7b7ec6316f3528104080e2d00a5cc5.1438200827.git.alistair.francis@xilinx.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v1 07/15] bitops: Add ONES macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, alistair.francis@xilinx.com, crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com, afaerber@suse.de From: Peter Crosthwaite Little macro that just gives you N ones (justified to LSB). Signed-off-by: Peter Crosthwaite --- include/qemu/bitops.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 8164225..27bf98d 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -430,4 +430,6 @@ static inline uint64_t deposit64(uint64_t value, int start, int length, return (value & ~mask) | ((fieldval << start) & mask); } +#define ONES(num) ((num) == 64 ? ~0ull : (1ull << (num)) - 1) + #endif -- 1.7.1