From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
"jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>,
"thomas@monjalon.net" <thomas@monjalon.net>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple
Date: Fri, 16 Mar 2018 14:11:19 +0530 [thread overview]
Message-ID: <20180316084118.GA5350@ltp-pvn> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB9772589E28F9A5@irsmsx105.ger.corp.intel.com>
Hi Konstantin,
On Wed, Mar 14, 2018 at 10:42:54AM +0000, Ananyev, Konstantin wrote:
> Hi Pavan,
>
> >
> > Add macros to align given value to the multiple of the supplied
> > integer.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > ---
> >
> > Common code needed for OcteonTx event timer device.
> >
> > lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
> > index c7803e41c..2052b5300 100644
> > --- a/lib/librte_eal/common/include/rte_common.h
> > +++ b/lib/librte_eal/common/include/rte_common.h
> > @@ -190,6 +190,22 @@ static void __attribute__((constructor(prio), used)) func(void)
> > */
> > #define RTE_ALIGN(val, align) RTE_ALIGN_CEIL(val, align)
> >
> > +/**
> > + * Macro to align a value to the multiple of given value. The resultant
> > + * value will be of the same type as the first parameter and will be no lower
> > + * than the first parameter.
> > + */
> > +#define RTE_ALIGN_MUL_CEIL(v, mul) \
> > + (((v + (typeof(v)) mul - 1) / ((typeof(v)) mul)) * (typeof(v))mul)
>
> I think you need to add braces around mul:
> (((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul))
> Same above.
Agreed, will roll up a v2.
> Konstantin
Thanks for reviewing,
Pavan.
>
> > +
> > +/**
> > + * Macro to align a value to the multiple of given value. The resultant
> > + * value will be of the same type as the first parameter and will be no higher
> > + * than the first parameter.
> > + */
> > +#define RTE_ALIGN_MUL_FLOOR(v, mul) \
> > + ((v / ((typeof(v)) mul)) * (typeof(v))mul)
> > +
> > /**
> > * Checks if a pointer is aligned to a given power-of-two value
> > *
> > --
> > 2.16.2
>
next prev parent reply other threads:[~2018-03-16 8:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 9:40 Pavan Nikhilesh
2018-03-14 9:41 ` [dpdk-dev] [PATCH 2/2] test: update common auto test Pavan Nikhilesh
2018-03-15 23:53 ` Thomas Monjalon
2018-03-16 8:56 ` Pavan Nikhilesh
2018-03-14 10:42 ` [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple Ananyev, Konstantin
2018-03-16 8:41 ` Pavan Nikhilesh [this message]
2018-03-20 13:24 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
2018-04-04 9:14 ` 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=20180316084118.GA5350@ltp-pvn \
--to=pbhagavatula@caviumnetworks.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
--cc=konstantin.ananyev@intel.com \
--cc=thomas@monjalon.net \
/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).