[dpdk-stable] [dpdk-dev] [PATCH] eal: fix large multiple calculation in reciprocal division

Stefan Kanthak stefan.kanthak at nexgo.de
Tue Apr 16 11:07:47 CEST 2019


Pavan Nikhilesh <pbhagavatula at marvell.com> wrote Sunday, April 14, 2019 7:22 AM:


> From: Pavan Nikhilesh <pbhagavatula at marvell.com>
> 
> Fix large multiple calculation in 64 bit reciprocal division.

This "fix" has a SERIOUS bug, it needs yet another fix.
I recommend to understand code first before you copy it!

[...]

> + int64_t i;

uint i = 64;

> + uint64_t t;
> +
> + for (i = 1; i <= 64; i++) {

do {

> + t = x >> 63;

t = (int64_t) x >> 63; // t is either 0ULL or ~0ULL

> + x = (x << 1) | (y >> 63);
> + y = y << 1;
> + if ((x | t) >= z) {
> + x = x - z;
> + y = y + 1;
> + }

} while (--i > 0);

Stefan Kanthak


More information about the stable mailing list