From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH v3 3/5] common: add missing implementations Date: Thu, 15 Nov 2018 08:40:08 +0000 Message-ID: <20181115083955.GA4757@jerin> References: <369642722f3c4d3d6c184fddb34b4aa7ce308a84.1542213812.git.anatoly.burakov@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "cristian.dumitrescu@intel.com" , "thomas@monjalon.net" , "bruce.richardson@intel.com" , "ferruh.yigit@intel.com" , "jasvinder.singh@intel.com" To: Anatoly Burakov Return-path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770074.outbound.protection.outlook.com [40.107.77.74]) by dpdk.org (Postfix) with ESMTP id 60B8A2BA1 for ; Thu, 15 Nov 2018 09:40:11 +0100 (CET) In-Reply-To: <369642722f3c4d3d6c184fddb34b4aa7ce308a84.1542213812.git.anatoly.burakov@intel.com> Content-Language: en-US Content-ID: <76625946430FE744AA4F7DEF84ECBAD3@namprd07.prod.outlook.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- > Date: Wed, 14 Nov 2018 16:47:08 +0000 > From: Anatoly Burakov > To: dev@dpdk.org > CC: cristian.dumitrescu@intel.com, thomas@monjalon.net, > bruce.richardson@intel.com, ferruh.yigit@intel.com, > jasvinder.singh@intel.com > Subject: [dpdk-dev] [PATCH v3 3/5] common: add missing implementations > X-Mailer: git-send-email 1.7.0.7 >=20 > External Email >=20 > Implement missing functions for 32-bit safe bsf, as well as 64-bit > fls and log2. >=20 > Signed-off-by: Anatoly Burakov > Acked-by: Cristian Dumitrescu > --- > +/** > + * Return the last (most-significant) bit set. > + * > + * @note The last (most significant) bit is at position 32. s/position 32/position 64 > + * @note rte_fls_u32(0) =3D 0, rte_fls_u32(1) =3D 1, rte_fls_u32(0x80000= 000) =3D 32 Fix here too IMO, it is better to add unit test case for newly added common functions in test/test/test_common.c > + * > + * @param x > + * The input parameter. > + * @return > + * The last (most-significant) bit set, or 0 if the input is 0. > + */ > +static inline int > +rte_fls_u64(uint64_t x) > +{ > + return (x =3D=3D 0) ? 0 : 64 - __builtin_clzll(x); > +} > +