From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0053.outbound.protection.outlook.com [104.47.34.53]) by dpdk.org (Postfix) with ESMTP id 608191B2BC for ; Sat, 17 Feb 2018 05:49:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7V2Zf3EYGKeq/kPv24NlAI2+EI5IytwTW0FQ9Koi0rU=; b=KG3RBkx7xAfuS+FbIrhjDMys8Bu5SpBbT+/kpHMny3p+CEbtC3bVLSVFOW1n15n2zzFRhrPsW2eqe3jKiYBAqxOt3R+xzI0k/pxso6Z1QVZVIdXdxDsTQPW0JrKVzhAFYnjCnxnS91zI1g+ezrZOPzysEOzZmwLAvHe/KMPGs0E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin (171.76.101.225) by BN3PR07MB2513.namprd07.prod.outlook.com (10.167.4.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Sat, 17 Feb 2018 04:49:44 +0000 Date: Sat, 17 Feb 2018 10:19:29 +0530 From: Jerin Jacob To: Pavan Nikhilesh Cc: santosh.shukla@caviumnetworks.com, erik.g.carrillo@intel.com, dev@dpdk.org Message-ID: <20180217044927.GA2941@jerin> References: <20180216213700.3415-1-pbhagavatula@caviumnetworks.com> <20180216213700.3415-2-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180216213700.3415-2-pbhagavatula@caviumnetworks.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [171.76.101.225] X-ClientProxiedBy: BM1PR0101CA0049.INDPRD01.PROD.OUTLOOK.COM (10.174.220.139) To BN3PR07MB2513.namprd07.prod.outlook.com (10.167.4.138) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 991e9c8c-327a-4220-b0d0-08d575c1de3e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:BN3PR07MB2513; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 3:GIKrK3qXC2KbmZAEurlczvsOrWQKF3RQw5FoVWTygqMtEoYcRMOcEDVb48iOeAwGOlTaa7Wv/rZb8NmxUThYR5UAq8JFlLDLof7Rv3R8BSTlWvGj2dJ2FO5fr5Bt/fBuTHLW5keopzTo2xAjvjomuH++6/LHdqz+ltC0rDB+A5GxAWeJHw3vgTMyF+sBeFt6szci/Qv2sK2XOHRjCOjTLtCQdofWFBB0Ks8eodVyXJq5urHzfVuyZkBdM1EmGLeD; 25:wn0M40s1FR4XOZmzTXPAvIQl01u1BLU1zAN74U9hPoa4kYnj9t+1SIm5dioMaEFmJ6T0VutcgMNC6meU7m+LiUYzYjopLS+lw/lmGoKdZYRuoxWpoY4ExC4mteDAzZwLc3mhwym5ZkqTjD0SU+eTJzybmHpluzi+gy6QNwrZ4/EWLLRcq8rniYV5W3lSjSlmMEtZ6wYQsrRWIJ9wVTcP8pXuiTOSd+svE0ojJdnFLfI+BMLNQs7GQKsVpdafmWIQPVn5k+MvuAjCcIZCydeWWRUgaW7swzphhi2NKQ+493qcCJX01+JHZrz2ohftcZpFylAL7PG37yvZaJvIOqzCig==; 31:SLDzuapvrp5qqJlT+skNKfUshwvD3qjSMUwxDth8O1jtku3BFfWG6/XLXwxTNnVROZQrYQOJRGYIAJ3xaPnf1cPJ5A9syDaYaxb5taUxhQGPPTKISosBBAkBuh0SAR0WkbqPPwIipBs0d43OmD3LlHt7Tcv+P19fBSOA/IEhRrzuQ94OwI4CZ9Ip5UCEbFYNpffLPVqrM/iFxmRTuDDaHJdjSjCQ258raEv0hGdDmqo= X-MS-TrafficTypeDiagnostic: BN3PR07MB2513: X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2513; 20:TqeyEYQKGQfGz1/dkrwncgVcH+bj0sN+T4ouVNx9QT03G5tRJeKbZhYKEiE2UcG3BuUFsYLgZUHflJ/v/7LylI3P//+0ofmQY7fMIcVzGS+hX5p9LTRIYIQaCyN/rw8ugtuama4CvuLnMIhxvndbLMuZv2UlCXlICwZ5zyPqUhCynZaSpbp5EFoskfZB4Snm87Yao6ctyj61jnlHkWHN2ZEn3jqjypeEHVXbfOmV4NYe9pTAbxY4kdASf3hNswijmyYgVE99QnZ6F9eULVQzjvg7Uk5s62wS9v3IKHfVKgGE0S3nY4DNDjRoYH7p9Y3ED6qzYx40NRL4o0uaGDqfMmFBAFEkjbN+9VIFve16XVuoJZ6o/d1MwTXF6Fd7fMOLf894mCImesM6G4aqxARTEQptBst/SLQbnoqExKJi+4jO9A0M81w9JyKwnoj++5aAM6i4G85wveJJiVQmfTNZ/BSYGDI9qD4qOsW4XDWYoxFi+rSvgXoGinBWLRvvqXKfV2SG5ZBWr+/pdl67IREQc4fLGFdvAUzVgyHeQNcYCV/+d4UdsVO3NTEcXY/Uf1J0qrWpJ0FW9r1lH1Un7OYe3zBj8DJC1y7e1hBPWaUK84Q=; 4:wuC2jWO3HvpIhVY/R/vULN7NoRvzEqY8k6A6Igdx6qoFwBX0q/oiz56ZJSLUcItBIuRTp6DRyQi+tT7FNcH3kagqB56K5NTRprDt2oOEOLN7+gjyjDNcUlO3Qn1tctRx9zUh+IYpraHLnOj+PggQzqrbqgnEuj2A3cx+vQYh2HfmS6rN7eE6s2RorIx1UlZMMSPWBoliOibodxmXFpigO8piXovnQo/uChu9XYqSkpbWA8BIdGPJ7hrmgv9p/NXgbhteEpEgubKnM5qGvqd1knCEoTAg7REuvv09dNx6mWyiidmgiYdSQ+3kv2cgx+rF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(944501161)(3002001)(93006095)(6041288)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:BN3PR07MB2513; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2513; X-Forefront-PRVS: 058637CA05 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(346002)(376002)(39380400002)(13464003)(189003)(199004)(16586007)(6496006)(33896004)(76176011)(72206003)(47776003)(50466002)(66066001)(478600001)(386003)(105586002)(8936002)(52116002)(81166006)(81156014)(8676002)(6666003)(6116002)(2950100002)(3846002)(23726003)(1076002)(42882006)(16526019)(33716001)(5660300001)(6246003)(2906002)(53936002)(26005)(25786009)(6862004)(6636002)(55016002)(68736007)(9686003)(4326008)(106356001)(58126008)(305945005)(33656002)(97736004)(83506002)(316002)(7736002)(229853002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR07MB2513; H:jerin; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR07MB2513; 23:eRjFQBE+LgFKdqnnuc+RR8vtPasPtLFQBBXx471/V?= =?us-ascii?Q?I3IBy+AJ731vavi9n6ZOe1zydsSUZSNCmEaTViBAjwcq03kHzrfvDMTaezI3?= =?us-ascii?Q?0W/bVVAVd5DvL4qMczvLCnJ7ahz8y2VrRVRiT+haYshwUSov1wQ/IzRxwNUa?= =?us-ascii?Q?lhApUaITllgOCheaNoYmb6YOv++G5Xv4jitUnH+FVsPrtOjl/4n8NT/Hg4t+?= =?us-ascii?Q?wmHsQKh500QDGB+HAL5eZh1UHm0+gUFnFdpGgcFUtSDFgZeLJhm7K5YB02Bi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NArTj+39HqASGkaEj1xSQQfFwtfvDXatKXXHB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2018 04:49:44.2455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 991e9c8c-327a-4220-b0d0-08d575c1de3e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2513 Subject: Re: [dpdk-dev] [PATCH 01/10] eal: add API to align variable to previous power of 2 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 04:49:50 -0000 -----Original Message----- > Date: Sat, 17 Feb 2018 03:06:51 +0530 > From: Pavan Nikhilesh > To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, > erik.g.carrillo@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh > Subject: [dpdk-dev] [PATCH 01/10] eal: add API to align variable to > previous power of 2 > X-Mailer: git-send-email 2.16.1 > > Add 32b and 64b API's to align the given variable to the previous power > of 2. I suggest to send common code changes in separate patch series with unit test case and mention the dependency in cover letter. > > Signed-off-by: Pavan Nikhilesh > --- > lib/librte_eal/common/include/rte_common.h | 36 ++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h > index c7803e41c..126914f07 100644 > --- a/lib/librte_eal/common/include/rte_common.h > +++ b/lib/librte_eal/common/include/rte_common.h > @@ -259,6 +259,24 @@ rte_align32pow2(uint32_t x) > return x + 1; > } > > +/** > + * Aligns input parameter to the previous power of 2 > + * > + * @param x > + * The integer value to algin > + * > + * @return > + * Input parameter aligned to the previous power of 2 > + */ > +static inline uint32_t > +rte_align32lowpow2(uint32_t x) > +{ > + x = rte_align32pow2(x); > + x--; > + > + return x - (x >> 1); > +} > + > /** > * Aligns 64b input parameter to the next power of 2 > * > @@ -282,6 +300,24 @@ rte_align64pow2(uint64_t v) > return v + 1; > } > > +/** > + * Aligns 64b input parameter to the previous power of 2 > + * > + * @param v > + * The 64b value to align > + * > + * @return > + * Input parameter aligned to the previous power of 2 > + */ > +static inline uint64_t > +rte_align64lowpow2(uint64_t v) > +{ > + v = rte_align64pow2(v); > + v--; > + > + return v - (v >> 1); > +} > + > /*********** Macros for calculating min and max **********/ > > /** > -- > 2.16.1 >