From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 712C5A0350; Wed, 24 Jun 2020 10:30:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3C7A71D969; Wed, 24 Jun 2020 10:30:23 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 2BBC51D958; Wed, 24 Jun 2020 10:30:21 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D0C095C00C7; Wed, 24 Jun 2020 04:30:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 24 Jun 2020 04:30:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= I7/0//KFc7clc/T/27W3PBzdFpeZTnrXNWjif8P3B/0=; b=WzUpoZQ952MABCiq ltIRInrrfU+NYhxAydYX+h8enUo6obC6C16fvULPDQOrmKRMYmj11zxtkaKF9420 83bSXIGCesTR9PWz5UZWCem/u2fPttoYnNDdDTISN2ofn8XM7WWQXa8UjAn/YU5G UVBjTNjJRc+JUeqopNPQTROoKn7uovv3sm4BBrKx1OT4E1CSevtu0pohxufLjkH9 oOoyewioVNLuGUcp8GLFTELNBSfN/8YM4AqYXOFtkIvL6jQpOd+0vQprOCKGJpXv oeQw47eNRKwiaULV/oJpqas/p690lEn1R/qyj64GPyoPlvcd5XSOixNH9Eh+b0ie TTlCnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=I7/0//KFc7clc/T/27W3PBzdFpeZTnrXNWjif8P3B /0=; b=f9oLIFLzxi02HTJlISuhHqPKy06kXUqDPBNfv4Ewcf+rSu94EtNoaHLkS d4UMkw9kz3s7wWU1W51jdUcGb+64xdavDad2VRuJRU/7TOG0DwSPIjYpL8UeVp4R qwYP9RPLHsQrlUjye2rQ2WqsziyuqflPBI9Gb1TWPmEQJOK978kPnRrtA+J6NoRk FbC3Y72OS1Y+6qjSvwJDgcF4xQvloEHIl3VnVkUL5V5slgQSccKQGMXu/4SfqJcu IE+7i4XlcXeuqZn+S6zpNFxCfXBatUpJhISbIV16YdK9ORGngEi418opyAFeVie6 muqbcRXpmBnyzAFIx7LIHrpkrju3w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekjedgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 87B683280059; Wed, 24 Jun 2020 04:30:19 -0400 (EDT) From: Thomas Monjalon To: Harman Kalra Cc: stephen@networkplumber.org, pbhagavatula@marvell.com, stable@dpdk.org, dev@dpdk.org, david.marchand@redhat.com Date: Wed, 24 Jun 2020 10:30:18 +0200 Message-ID: <2473627.Zvk6BpfnDP@thomas> In-Reply-To: <20200624082429.GA73382@outlook.office365.com> References: <1591730225-15300-1-git-send-email-hkalra@marvell.com> <2094499.cageA7459N@thomas> <20200624082429.GA73382@outlook.office365.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [EXT] Re: [dpdk-stable] [PATCH] eal: fix macros to align value 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 24/06/2020 10:24, Harman Kalra: > On Wed, Jun 24, 2020 at 10:13:18AM +0200, Thomas Monjalon wrote: > > 09/06/2020 21:17, Harman Kalra: > > > Found an issue while using RTE_ALIGN_MUL_NEAR with an > > > expression, like as passed in estimate_tsc_freq(). > > > RTE_ALIGN_MUL_FLOOR resulted in unexpected value in the > > > above function as division has more precedence over > > > substraction. > > > > The only change I see is adding parenthesis around v. > > Am I right? > > Yes, parathesis are required if an expression is passed. I think the commit log needs to be updated. I don't see the relation between "division has more precedence over substraction" and "parathesis are required if an expression is passed" > > > #define RTE_ALIGN_MUL_CEIL(v, mul) \ > > > - (((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > > > + ((((v) + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > > [...] > > > #define RTE_ALIGN_MUL_FLOOR(v, mul) \ > > > - ((v / ((typeof(v))(mul))) * (typeof(v))(mul)) > > > + (((v) / ((typeof(v))(mul))) * (typeof(v))(mul)) > > [...] > > > ({ \ > > > typeof(v) ceil = RTE_ALIGN_MUL_CEIL(v, mul); \ > > > typeof(v) floor = RTE_ALIGN_MUL_FLOOR(v, mul); \ > > > - (ceil - v) > (v - floor) ? floor : ceil; \ > > > + (ceil - (v)) > ((v) - floor) ? floor : ceil; \ > > > }) > > > > > > > > >