DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Harman Kalra <hkalra@marvell.com>
Cc: stephen@networkplumber.org, pbhagavatula@marvell.com,
	stable@dpdk.org, dev@dpdk.org, david.marchand@redhat.com
Subject: Re: [dpdk-dev] [EXT] Re: [dpdk-stable] [PATCH] eal: fix macros to align value
Date: Wed, 24 Jun 2020 10:30:18 +0200	[thread overview]
Message-ID: <2473627.Zvk6BpfnDP@thomas> (raw)
In-Reply-To: <20200624082429.GA73382@outlook.office365.com>

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;	\
> > >  	})
> > 
> > 
> > 
> > 
> 






  reply	other threads:[~2020-06-24  8:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 19:17 [dpdk-dev] " Harman Kalra
2020-06-24  8:13 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2020-06-24  8:24   ` [dpdk-dev] [EXT] " Harman Kalra
2020-06-24  8:30     ` Thomas Monjalon [this message]
2020-06-24 10:02       ` Harman Kalra
2020-06-24 10:20       ` [dpdk-dev] [PATCH v2] " Harman Kalra
2020-07-11  9:44         ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2473627.Zvk6BpfnDP@thomas \
    --to=thomas@monjalon.net \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).