From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E54675F34 for ; Wed, 14 Mar 2018 11:42:58 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 03:42:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,469,1515484800"; d="scan'208";a="24421488" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by fmsmga008.fm.intel.com with ESMTP; 14 Mar 2018 03:42:56 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 14 Mar 2018 10:42:55 +0000 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.221]) by irsmsx112.ger.corp.intel.com ([169.254.1.242]) with mapi id 14.03.0319.002; Wed, 14 Mar 2018 10:42:55 +0000 From: "Ananyev, Konstantin" To: Pavan Nikhilesh , "jerin.jacob@caviumnetworks.com" , "thomas@monjalon.net" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple Thread-Index: AQHTu3jRVC2Fnu45OU6jEXwS1UdD06PPiudQ Date: Wed, 14 Mar 2018 10:42:54 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772589E28F9A5@irsmsx105.ger.corp.intel.com> References: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com> In-Reply-To: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDg0MGVkZTUtOWMxNS00NWY4LWI5N2UtNDY0ZThmYzljYTdiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImtjWFlDRXd3Y0s3R2JmclBrU2ZFQzhoYVEzSzZFbEpRYVhLcllmRzFmWW89In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple 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: Wed, 14 Mar 2018 10:42:59 -0000 Hi Pavan, >=20 > Add macros to align given value to the multiple of the supplied > integer. >=20 > Signed-off-by: Pavan Nikhilesh > --- >=20 > Common code needed for OcteonTx event timer device. >=20 > lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > 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) >=20 > +/** > + * 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. Konstantin > + > +/** > + * 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