mpn_divexact_1 comments

2013-10-16 Thread Mark Sofroniou
I noticed a couple of minor issues in mpn_divexact_1 (dive1.c) that are not in my own implementation, so I thought I'd pass them on. If the quotient will be one word shorter than the dividend then set the top word to zero: if ((divisor 1) == 0) { if ((dst != src) (src[size - 1]

Re: mpn_divexact_1 comments

2013-10-16 Thread Niels Möller
Mark Sofroniou ma...@wolfram.com writes: If the quotient will be one word shorter than the dividend then set the top word to zero: if ((divisor 1) == 0) { if ((dst != src) (src[size - 1] divisor)) dst[size - 1] = 0; ... I don't understand. Doesn't the current loop always

Re: mpn_divexact_1 comments

2013-10-16 Thread Torbjorn Granlund
I agree with Niels (don't understand + not appropriate for low-level...). We should replace mpn_divexact_1 with code that: (1) Uses Jebelean's trick with a Euclidean division working left-to- right and a simultaneous Hensel division working right-to-left. This is faster in the