From patchwork Fri Jun 24 15:42:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 640264 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 3rbjL22rqZz9sC4 for ; Sat, 25 Jun 2016 01:43:54 +1000 (AEST) Received: from localhost ([::1]:44394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGTGq-0003Fo-25 for incoming@patchwork.ozlabs.org; Fri, 24 Jun 2016 11:43:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGTFZ-0000jm-Sv for qemu-devel@nongnu.org; Fri, 24 Jun 2016 11:42:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGTFU-0002ag-JQ for qemu-devel@nongnu.org; Fri, 24 Jun 2016 11:42:32 -0400 Received: from mail-cys01nam02on0069.outbound.protection.outlook.com ([104.47.37.69]:40995 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGTFU-0002aa-9O for qemu-devel@nongnu.org; Fri, 24 Jun 2016 11:42:28 -0400 Received: from BL2NAM02FT054.eop-nam02.prod.protection.outlook.com (10.152.76.57) by BL2NAM02HT108.eop-nam02.prod.protection.outlook.com (10.152.77.128) with Microsoft SMTP Server (TLS) id 15.1.523.9; Fri, 24 Jun 2016 15:42:25 +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 BL2NAM02FT054.mail.protection.outlook.com (10.152.77.107) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Fri, 24 Jun 2016 15:42:25 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:45484 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1bGTFR-0002S0-3m; Fri, 24 Jun 2016 08:42:25 -0700 Received: from [127.0.0.1] (port=54324 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1bGTFR-0004aZ-0k; Fri, 24 Jun 2016 08:42:25 -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 u5OFZqVM022964; Fri, 24 Jun 2016 08:35:52 -0700 Received: from [172.19.74.182] (port=54334 helo=xsjalistai50.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1bGTFQ-0004aW-2X; Fri, 24 Jun 2016 08:42:24 -0700 From: Alistair Francis To: , Date: Fri, 24 Jun 2016 08:42:10 -0700 Message-ID: <196447efd13ed073cf0d4e96d8c8951475ff0ad3.1466782459.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-22410.005 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)(1110001)(1109001)(339900001)(199003)(189002)(50986999)(5820100001)(76176999)(189998001)(229853001)(86362001)(6806005)(5001770100001)(586003)(23676002)(81166006)(81156014)(8676002)(92566002)(118296001)(71366001)(64026002)(356003)(19580395003)(19580405001)(47776003)(50226002)(77096005)(36756003)(7846002)(9786002)(305945005)(87936001)(33646002)(2950100001)(105606002)(2906002)(4326007)(106466001)(2870700001)(8936002)(50466002)(85426001)(11100500001)(5003600100003)(7696003)(427584002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2NAM02HT108; 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: 99878ab5-93f2-4eb9-4092-08d39c462430 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT108; X-Microsoft-Antispam-PRVS: <72b2c19e688c4010b45264380739f491@BL2NAM02HT108.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)(8121501046)(13017025)(5005006)(13023025)(13024025)(13018025)(13015025)(10201501046)(3002001)(6055026); SRVR:BL2NAM02HT108; BCL:0; PCL:0; RULEID:; SRVR:BL2NAM02HT108; X-Forefront-PRVS: 0983EAD6B2 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2016 15:42:25.6438 (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: BL2NAM02HT108 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.69 Subject: [Qemu-devel] [PATCH v8 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