From mboxrd@z Thu Jan 1 00:00:00 1970 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) 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:X-MS-Exchange-SenderADCheck; bh=ag/08fiKudrKvLBXTqkfRkc9k4NlC2iDOPbeKYyunrE=; b=fK2VzQ4MJnm8VaSh3Pkyrd0X3XHB4o4Co9trXXoBBsrHpJri7sSUwvgEQr/02k44QCxi/Gim/w1hIEh4tIzNmCzChj6jG+aKL2BEfMEDNWiA2g0g8UDRxxNO3+U6RmXVqQ0ZTuiUDf6f/0PAvS+fFOm2u2ihltWmQM7yj/R/sMY= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB4533.namprd07.prod.outlook.com (52.135.225.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1339.20; Thu, 15 Nov 2018 08:40:08 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::2d56:eab:242f:fdfc]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::2d56:eab:242f:fdfc%3]) with mapi id 15.20.1339.021; Thu, 15 Nov 2018 08:40:08 +0000 From: Jerin Jacob To: Anatoly Burakov CC: "dev@dpdk.org" , "cristian.dumitrescu@intel.com" , "thomas@monjalon.net" , "bruce.richardson@intel.com" , "ferruh.yigit@intel.com" , "jasvinder.singh@intel.com" Thread-Topic: [dpdk-dev] [PATCH v3 3/5] common: add missing implementations Thread-Index: AQHUfDm/VmM7W79iSEi1USfsCeA+vKVQhR+A Date: Thu, 15 Nov 2018 08:40:08 +0000 Message-ID: <20181115083955.GA4757@jerin> References: <369642722f3c4d3d6c184fddb34b4aa7ce308a84.1542213812.git.anatoly.burakov@intel.com> In-Reply-To: <369642722f3c4d3d6c184fddb34b4aa7ce308a84.1542213812.git.anatoly.burakov@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [111.93.218.67] x-clientproxiedby: BM1PR01CA0123.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:40::17) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB4533; 6:E59XESVKvdteGh+k5M1GSd1komBmYOFlyq2xWBvPwx3ou8V+b33kFXKB1l4azgHGkW4bFJ1LtBwxtaSDfw7JoOchjoARFSQ4xqOO4FF/ttZnyK+ASKrPk5ND/f7TqCqyXrsLq5WLJGX9jHaUDebXlQF/Yg+t8GV2MqzMIxTJTbzpJDoW2Etv42cvKzDrTjqgpXPVG9gXh1fG/isfbZyZFTr1nL0BaWwOu3kvEu6cbuMV0wAjWjQwjNnuxblh67SDMC+MVrJ+vrmr52W9BFgP9/Dvh2MAnzrxGdY6oBYBIqKfr6knNvRYlK1bQVBpxl2ejlkjrcbRKcTENTymhLATuVn6E/9cfwDM9IvL4M6JPXX/IENyq5gwO50g4bghcbZ7dV3ZPAe8u/wfX6GY1KWFuv2C8HBtTFXbK4UkZaXupumr8TGnGPJwD4dyX08yJydxp5BYgOpQuVObHBgGeJ9hjg==; 5:RnC3bpqZosUUfdQ5paeqY4VU6gJsliQYX8P03QxsfcxeLVD6i4Ev4OpOAr2ZiizUmDa4bfkgX3A6EjxnWXlRWU9GYTptMnu+uAs02slPTgjTKXhevvNrBrGXu0+Qt44JV5Yeg8rGUvLjHXU503Y52sA05WPdIXtc7B8RGpj7ZnY=; 7:5UZlsPqMk3dePMHa6BP2loiiJjilJVgRSsqhbRkHtHYQA0SrE096S9eJLfr2+YPN+GqIE2JNh/H4vUDoTd4Dc/BwQvpcfP8MfDF4uS2YuEtmG/a/YYIUzO0vuE3Q0L3zx4jKFhP7eSyzINdzAtDRig== x-ms-office365-filtering-correlation-id: 2fa47a3b-426b-4b5b-8f34-08d64ad5f2f3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4533; x-ms-traffictypediagnostic: BYAPR07MB4533: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(3231415)(944501410)(52105112)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:BYAPR07MB4533; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4533; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(7916004)(39860400002)(366004)(396003)(376002)(346002)(136003)(199004)(189003)(13464003)(6916009)(14454004)(2906002)(4326008)(229853002)(26005)(5660300001)(33656002)(72206003)(102836004)(1076002)(9686003)(186003)(6116002)(6512007)(6486002)(3846002)(6436002)(33716001)(54906003)(316002)(256004)(76176011)(53936002)(52116002)(99286004)(71190400001)(71200400001)(305945005)(106356001)(8936002)(11346002)(105586002)(7736002)(446003)(25786009)(66066001)(2900100001)(486006)(8676002)(68736007)(476003)(478600001)(78486014)(81156014)(81166006)(386003)(97736004)(6246003)(6506007)(33896004)(42882007); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4533; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: v1hEDfFRRMVyCv5eWknSNV2n5P+4/C64Akt7HhqiWi/0o2A0r1qerpw75qHAWZnOOyzeXqc51JUA7j2kObwZ579goqbulRunI232CdJK604hoOrgNLYbaiZswVA1dBAwBzFhXtAffY/5MkEk0NN31vyxV0uFR6hzLWOxlF2NOqzlIBexuw+57fWj5yNO3NvZM2G0/oYC7bitJ1iQVYMoxWiTc1jWb3E99hA/3Vd/tyCwiLDI9yv/UZcf+SJafvbNTffxNJ+8bj2swyNLJObUD5Pa4dCUt0v8Cp7Zs7AKKwwd2/vMu1FTbwkqxVMvc/YadguYN/cNhPFmM3xvbICMGgUCJhQKhypHWn+KR4ZbnII= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <76625946430FE744AA4F7DEF84ECBAD3@namprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa47a3b-426b-4b5b-8f34-08d64ad5f2f3 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 08:40:08.6343 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4533 Subject: Re: [dpdk-dev] [PATCH v3 3/5] common: add missing implementations 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: Thu, 15 Nov 2018 08:40:11 -0000 -----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); > +} > +