From patchwork Mon Jun 27 18:53:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 641187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rddRV6BXfz9sCg for ; Tue, 28 Jun 2016 04:55:18 +1000 (AEST) Received: from localhost ([::1]:60461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHbgi-0004vt-PS for incoming@patchwork.ozlabs.org; Mon, 27 Jun 2016 14:55:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHbfF-0003op-2K for qemu-devel@nongnu.org; Mon, 27 Jun 2016 14:53:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHbfA-0006B8-US for qemu-devel@nongnu.org; Mon, 27 Jun 2016 14:53:44 -0400 Received: from mail-sn1nam02on0071.outbound.protection.outlook.com ([104.47.36.71]:51804 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHbfA-0006Aw-Ks for qemu-devel@nongnu.org; Mon, 27 Jun 2016 14:53:40 -0400 Received: from CY1NAM02FT004.eop-nam02.prod.protection.outlook.com (10.152.74.59) by CY1NAM02HT245.eop-nam02.prod.protection.outlook.com (10.152.75.160) with Microsoft SMTP Server (TLS) id 15.1.523.9; Mon, 27 Jun 2016 18:53:37 +0000 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=xilinx.com; linaro.org; dkim=none (message not signed) header.d=none; linaro.org; dmarc=none action=none header.from=xilinx.com; Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 149.199.60.96 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.96; helo=xsj-tvapsmtpgw01; Received: from xsj-tvapsmtpgw01 (149.199.60.96) by CY1NAM02FT004.mail.protection.outlook.com (10.152.74.112) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Mon, 27 Jun 2016 18:53:37 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:39807 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1bHbf6-0006I4-OJ; Mon, 27 Jun 2016 11:53:36 -0700 Received: from [127.0.0.1] (port=48647 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1bHbf6-0006X4-Kz; Mon, 27 Jun 2016 11:53:36 -0700 Received: from xsj-tvapsmtp02 (xsj-tvapsmtp02.xilinx.com [172.16.1.203]) by tsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u5RIl2Hx022935; Mon, 27 Jun 2016 11:47:03 -0700 Received: from [172.19.74.182] (port=60366 helo=xsjalistai50.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1bHbf5-0006X1-Jz; Mon, 27 Jun 2016 11:53:35 -0700 From: Alistair Francis To: , Date: Mon, 27 Jun 2016 11:53:16 -0700 Message-ID: <9773244aa1c8c26b8b82cb261d8f5dd4b7b9fcf9.1467053537.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-RCIS-Action: ALLOW X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22416.006 X-TM-AS-Result: No-0.138-7.0-31-10 X-imss-scan-details: No-0.138-7.0-31-10 X-TMASE-MatchedRID: tiRXYRqWr+tJOUjEvT0q+2NW0DAjL5p+2MmowBCx0sH4JyR+b5tvoErQ UCy1ylPS5o/rYvVL+idftuJwrFEhTRMQLQ/0+9hG3QfwsVk0UbsIoUKaF27lxQxWwOlCSa+IUfT mRnCmBdwJrxkhoAozqyZLIUCCWM9H3JfsX5UQs170XXecAU8U1lkYO1sgYLh1KjtioLKKZaeZww jSTvVjPhMBexWs+SIH3D94QFatAxc21XLFpkB2YKzp5y15pXcI+rL5VW+ofZc= X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.96; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(50466002)(33646002)(50226002)(47776003)(8936002)(86362001)(9786002)(105606002)(7846002)(106466001)(356003)(87936001)(36756003)(5003600100003)(7696003)(5820100001)(118296001)(229853001)(2870700001)(19580395003)(77096005)(19580405001)(305945005)(85426001)(8676002)(92566002)(23676002)(586003)(2950100001)(71366001)(50986999)(6806005)(11100500001)(189998001)(76176999)(64026002)(2906002)(81166006)(5001770100001)(4326007)(81156014)(427584002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1NAM02HT245; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; PTR:unknown-60-96.xilinx.com; A:1; MX:1; CAT:NONE; LANG:en; CAT:NONE; X-MS-Office365-Filtering-Correlation-Id: b538bbe4-2be9-4c34-2b68-08d39ebc590d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1NAM02HT245; X-Microsoft-Antispam-PRVS: <022a5a7eb30545ef9bb64573fc1e6693@CY1NAM02HT245.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(5005006)(8121501046)(13023025)(13024025)(13018025)(13015025)(10201501046)(3002001)(6055026); SRVR:CY1NAM02HT245; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT245; X-Forefront-PRVS: 09860C2161 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2016 18:53:37.0384 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.96]; Helo=[xsj-tvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT245 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.71 Subject: [Qemu-devel] [PATCH v9 1/8] bitops: Add MAKE_64BIT_MASK macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, alistair.francis@xilinx.com, crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com, alex.bennee@linaro.org, afaerber@suse.de, fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a macro that creates a 64bit value which has length number of ones shifted across by the value of shift. Signed-off-by: Alistair Francis Reviewed-by: Alex Bennée Reviewed-by: Peter Maydell --- V7: - Fixup commit typo - Use the method from deposit64() 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 15418a8..98fb005 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) \ + (((~0ULL) >> (64 - (length))) << (shift)) + /** * set_bit - Set a bit in memory * @nr: the bit to set