Re: Simplify X * C1 == C2 with wrapping overflow

2020-08-10 Thread Jakub Jelinek via Gcc-patches
On Sun, Aug 09, 2020 at 11:24:54PM +0200, Marc Glisse wrote: > Odd numbers are invertible in Z / 2^n Z, so X * C1 == C2 can be rewritten as > X == C2 * inv(C1) when overflow wraps. > > mod_inv should probably be updated to better match the other wide_int > functions, but that's a separate issue. >

Simplify X * C1 == C2 with wrapping overflow

2020-08-09 Thread Marc Glisse
Odd numbers are invertible in Z / 2^n Z, so X * C1 == C2 can be rewritten as X == C2 * inv(C1) when overflow wraps. mod_inv should probably be updated to better match the other wide_int functions, but that's a separate issue. Bootstrap+regtest on x86_64-pc-linux-gnu. 2020-08-10 Marc Glisse