Re: div_qr_1 interface

2013-10-17 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: To get going, I've written C implementations of mpn_div_qr_1n_pi1 and mpn_divf_qr1n_pi1, and made divrem_1 call them. Below, also an mpn_div_qr_1, using these primitives (and with some inspiration from divrem_1). For return value, I use the type

Re: div_qr_1 interface

2013-10-17 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: ni...@lysator.liu.se (Niels Möller) writes: To get going, I've written C implementations of mpn_div_qr_1n_pi1 and mpn_divf_qr1n_pi1, and made divrem_1 call them. Below, also an mpn_div_qr_1, using these primitives (and with some

Re: div_qr_1 interface

2013-10-17 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: I am not too enthusiastic about struct return types for critical functions. I expect this to be returned via a stack slot everywhere o almost everywhere. As far as I understand, the most common ABIs for x86_64 and ARM (which is pretty close to almost

Re: div_qr_1 interface

2013-10-17 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes: Consider the test compilation unit typedef struct { unsigned long q; unsigned long r; } qr_t; qr_t divrem (unsigned long u, unsigned long d) { qr_t res; res.q = u/d; res.r = u - res.q*d; return res; } On