From patchwork Wed Jun 22 20:23:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 9193703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A71C6075F for ; Wed, 22 Jun 2016 20:24:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BEE828416 for ; Wed, 22 Jun 2016 20:24:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5051928411; Wed, 22 Jun 2016 20:24:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB9A928411 for ; Wed, 22 Jun 2016 20:24:54 +0000 (UTC) Received: from localhost ([::1]:60654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFohh-0008R5-Rd for patchwork-qemu-devel@patchwork.kernel.org; Wed, 22 Jun 2016 16:24:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFohA-0008Ol-FA for qemu-devel@nongnu.org; Wed, 22 Jun 2016 16:24:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFoh5-0003w6-6f for qemu-devel@nongnu.org; Wed, 22 Jun 2016 16:24:19 -0400 Received: from mail-cys01nam02on0048.outbound.protection.outlook.com ([104.47.37.48]:61135 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFoh4-0003vv-TL for qemu-devel@nongnu.org; Wed, 22 Jun 2016 16:24:15 -0400 Received: from CY1NAM02FT025.eop-nam02.prod.protection.outlook.com (10.152.74.52) by CY1NAM02HT023.eop-nam02.prod.protection.outlook.com (10.152.75.56) with Microsoft SMTP Server (TLS) id 15.1.523.9; Wed, 22 Jun 2016 20:24:02 +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 CY1NAM02FT025.mail.protection.outlook.com (10.152.75.148) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Wed, 22 Jun 2016 20:24:02 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:56764 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1bFogs-00076s-38; Wed, 22 Jun 2016 13:24:02 -0700 Received: from [127.0.0.1] (port=37372 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1bFogr-0004gk-Vs; Wed, 22 Jun 2016 13:24:02 -0700 Received: from xsj-tvapsmtp02 (smtptest.xilinx.com [172.16.1.203]) by tsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u5MKHU7u002037; Wed, 22 Jun 2016 13:17:30 -0700 Received: from [172.19.74.182] (port=37770 helo=xsjalistai50.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1bFogq-0004gh-RB; Wed, 22 Jun 2016 13:24:00 -0700 From: Alistair Francis To: , Date: Wed, 22 Jun 2016 13:23:47 -0700 Message-ID: <45fc995a0bc77763e295e5d25fba2dacac3997d5.1466626975.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-22406.005 X-TM-AS-Result: No--0.094-7.0-31-10 X-imss-scan-details: No--0.094-7.0-31-10 X-TMASE-MatchedRID: cAwOsowI+VJJOUjEvT0q+2NW0DAjL5p+UAjrAJWsTe8fMHqnxIWfEegV 4TkxLE0x585VzGMOFzAQVjqAOZ5cjQtuKBGekqUpnH7sbImOEBQ5U6UAJTTBu29mHGCBuj961ad nmGGIdqqy8GM2ThXJ70SMcbunEPpgY8w/13WKsf3Ee7Ixt7zanhHAqpuDiuv89QiB6y4o8uTVRi rBk7dv0usjkYn56VGqDVGHlX3Atkd4mTaDVMyoFGA7bUFBqh2V X-EOPAttributedMessage: 0 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)(189002)(199003)(5001770100001)(76176999)(2950100001)(50986999)(9786002)(86362001)(105606002)(81156014)(81166006)(189998001)(33646002)(5820100001)(106466001)(2870700001)(50466002)(4326007)(87936001)(6806005)(356003)(50226002)(19580395003)(2906002)(19580405001)(23676002)(92566002)(5003600100003)(7696003)(118296001)(47776003)(77096005)(586003)(8936002)(11100500001)(36756003)(7846002)(229853001)(8676002)(71366001)(85426001)(64026002)(305945005)(427584002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1NAM02HT023; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; PTR:unknown-60-96.xilinx.com; MX:1; A:1; CAT:NONE; LANG:en; CAT:NONE; X-MS-Office365-Filtering-Correlation-Id: ff85aa05-bbb5-4ed0-36fb-08d39adb26ce X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1NAM02HT023; X-Microsoft-Antispam-PRVS: <6eb2a3535a0943f0b8edf48607cdc033@CY1NAM02HT023.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)(13023025)(13024025)(13015025)(13018025)(13017025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:CY1NAM02HT023; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT023; X-Forefront-PRVS: 0981815F2F X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2016 20:24:02.4873 (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: CY1NAM02HT023 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.48 Subject: [Qemu-devel] [PATCH v7 01/12] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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