From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matan Azrad Subject: Re: [PATCH v2 1/2] eal: add API to align integer to previous power of 2 Date: Tue, 27 Feb 2018 19:30:40 +0000 Message-ID: References: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> <20180219113643.10337-1-pbhagavatula@caviumnetworks.com> <20180226191017.GA9950@ltp-pvn> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: Pavan Nikhilesh , "jerin.jacob@caviumnetworks.com" , "keith.wiles@intel.com" , Thomas Monjalon Return-path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00058.outbound.protection.outlook.com [40.107.0.58]) by dpdk.org (Postfix) with ESMTP id 150D42A7 for ; Tue, 27 Feb 2018 20:30:42 +0100 (CET) In-Reply-To: <20180226191017.GA9950@ltp-pvn> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Pavan From: Pavan Nikhilesh, Monday, February 26, 2018 9:10 PM > Hi Matan, >=20 > On Mon, Feb 19, 2018 at 12:09:46PM +0000, Matan Azrad wrote: > > Since you are using the same 5 lines from the rte_align32pow2() functio= n, I >> think this part can be in a separate function to do reuse. > > Also the "fill ones 32" function can be used for other purpose. > > What do you think? >=20 > I do agree that it would be cleaner to have a common function for both, b= ut > not able to decide on a appropriate function name "fill ones 32" doesn't > convey what the function truly does. If you have a cleaner name do sugges= t, i > will roll up a v3 adding the function and experimental tag. Sure. I'm suggesting next names: rte_combine32ms1b(register uint32_t x) rte_combine64ms1b(register uint64_t x) The description may be something like: combine the upper bits into the LSBs to construct a value with the same mos= t significant 1 as x but all 1's under it. I would add the register keyword for each variables in all the align functi= ons here just to hint for the compiler that it's better to save this variab= les in register and not in memory. =20 Matan. > Thanks, > Pavan >=20 > > > >