Re: [mpir-devel] Re: Yet another question... (hopefully the last one for a while...)

2011-03-11 Thread Bill Hart
The correct way to get a given limb is with mpz_getlimbn (mpz t op, mp size t n ). The number of limbs is given by mpz_size (mpz t op ) . These are both on page 44 of the manual. Of course you need to deal with the case that the mpz has size 0 separately. Bill. On 11 March 2011 14:52, Cactus wro

[mpir-devel] Re: The 'length of long' issue

2011-03-11 Thread Cactus
On Mar 9, 5:55 pm, Case Vanhorsen wrote: > On Wed, Mar 9, 2011 at 8:53 AM, Cactus wrote: > > > On Mar 8, 8:21 pm, Cactus wrote: > >> On Feb 14, 10:18 am, Jason wrote: > > >> > On Sunday 13 February 2011 16:43:47 Cactus wrote: > > >> > > [cut previous text] > > >> > > > > Probably the easiest

[mpir-devel] Re: Yet another question... (hopefully the last one for a while...)

2011-03-11 Thread Cactus
On Mar 11, 2:11 pm, Steve wrote: > On 11/03/2011 13:47, Cactus wrote: > > > The manual explains mpz_export that gives you such access but it won't > > avoid the cost of an array for the results. > > > The mpz structure contains an integer (_mp_size) whose absolute value > > gives the number of l

Re: [mpir-devel] Re: Yet another question... (hopefully the last one for a while...)

2011-03-11 Thread Steve
On 11/03/2011 13:47, Cactus wrote: > The manual explains mpz_export that gives you such access but it won't > avoid the cost of an array for the results. > > The mpz structure contains an integer (_mp_size) whose absolute value > gives the number of limbs pointed to by the limb pointer (_mp_d). > >

[mpir-devel] Re: Yet another question... (hopefully the last one for a while...)

2011-03-11 Thread Cactus
On Mar 11, 1:28 pm, Steve wrote: > I've  large positive mpz_t values, and I need to access them one byte > (or one word) at a time. > > Obviously, I could do this using mpz_div_2exp() and mpz_get_ui() -  but > this gets me the least significant words first... and I need to access > the data most

[mpir-devel] Yet another question... (hopefully the last one for a while...)

2011-03-11 Thread Steve
I've large positive mpz_t values, and I need to access them one byte (or one word) at a time. Obviously, I could do this using mpz_div_2exp() and mpz_get_ui() - but this gets me the least significant words first... and I need to access the data most-significant word first. Sure, I could do this

[mpir-devel] Re: Possible bug in mpn_mul

2011-03-11 Thread Cactus
On Mar 9, 12:35 am, Fredrik Johansson wrote: > Hi, > > On my system, valgrind detects an invalid read in mpn_mul when the > operands have certain sizes. For example, it happens when both operand > lengths are 2601 limbs. I'm attaching a test .c program and valgrind > output. > > I just re-ran "m