[dpdk-dev] [PATCH 2/2] eal: add u64 bit variant for reciprocal

Pavan Nikhilesh Bhagavatula pbhagavatula at caviumnetworks.com
Wed Aug 30 06:05:43 CEST 2017


On Tue, Aug 29, 2017 at 12:38:00PM -0700, Stephen Hemminger wrote:
> On Wed, 30 Aug 2017 00:16:18 +0530
> Pavan Nikhilesh <pbhagavatula at caviumnetworks.com> wrote:
>
Hi Stephen,

> > +static inline uint64_t
> > +mullhi_u64(uint64_t x, uint64_t y)
> >  {
> > -	uint32_t t = (uint32_t)(((uint64_t)a * R.m) >> 32);
> > +	__uint128_t xl = x;
> > +	__uint128_t yl = y;
> > +	__uint128_t rl = xl * yl;
> > +	return (uint64_t)(rl >> 64);
> > +}
>
> Cast in return not necessary. And cast when setting t not necessary.
> Please blank line after declarations.
>
> Also you don't need to cast both sides of multiply. Some compilers maybe
> able to optimize 128 bit * 64 bit.

Thanks for the inputs, will do the required changes along with removing license
in v2.

-Pavan


More information about the dev mailing list