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 B78A8A0350; Wed, 24 Jun 2020 10:13:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 606A01DA10; Wed, 24 Jun 2020 10:13:23 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 2966F1D9E2; Wed, 24 Jun 2020 10:13:21 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id C15BC5C00E0; Wed, 24 Jun 2020 04:13:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 24 Jun 2020 04:13: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= yPRJermDj6NM3vj1dFCzMe4ntOwHzi7Hd6jYtQlDHx0=; b=WyktNvXRSC/cRgol kidu4LNMVF/SfRNppp4SgBwQnam748j0zm8Vyh7rWYXpGNjUh1qMJeiBAPsftHUo lXOMtc6PwzHj6WvRHQlb77JBvVJh4gEek+9oLB4/AU8m5gXxWRYKAdK3n8dgtNlV GGRCyDpS2k3neZ4/0t4YisGngkaG6Op87WbxDnRGuEvEUMuqgbkP9bSf3hwg83Af 0Dd1Ealsd7iBT+AiE4TSj0eKZtmHW6pt2jFLiBTyhdl44BdI6UtxGWgCbUAwA2s5 ZK14oYZl4+KkJ4B5hZ3XzoMPY5jQ1wIA+DwBzJa8+DoxjHWnZ5bHXjI+T2ZYcoBd kPk5Fw== 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=yPRJermDj6NM3vj1dFCzMe4ntOwHzi7Hd6jYtQlDH x0=; b=WRt/KpQ5z4aA8/+X/iTIYDAVrUo+BY4F3r85VgOWK1313gJdFxcehaWdF eRGT1LxfuqBFBZ35LiLFMHC2GpHA/8w7iCzM98hUToR92LoMFeBDq0z8LMEtDeCM zKhsKdRd7Q7Fn2pmjNhC9ZKFsDOTkzC/Wim8fpJvB6EjQx7ejP3to2SsRt+RgAJD s3yt7G86XtaAmcFQD7S9qrtTMDD36aBr1dK0zikq7gdBPdf0wxsx2nSPILftpDBC bSJTy4rZV3pnbatIv+GcG8tV0n0Wrt/bpBTZwpy6gW8cSUvUsPjVSYqFZIybuxxg kkaQ54M16MMj5HuiormzS/RK6AfcQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekjedgtdefucetufdoteggodetrfdotf 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 C8D4C3067629; Wed, 24 Jun 2020 04:13: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:13:18 +0200 Message-ID: <2094499.cageA7459N@thomas> In-Reply-To: <1591730225-15300-1-git-send-email-hkalra@marvell.com> References: <1591730225-15300-1-git-send-email-hkalra@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [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" 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? > #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; \ > })