gmp-4.1.2 assertion failure

Jason jasonmoxham at btclick.com
Tue Feb 17 01:23:23 CET 2004


On Tuesday 17 Feb 2004 12:53 am, Kevin Ryde wrote:
> Jason <jasonmoxham at btclick.com> writes:
> > +    if (GMP_NUMB_BITS == 32)					\
> > +      q = (nl >> 5) | (nh << (GMP_LIMB_BITS - 5));		\
> > +    else if (GMP_NUMB_BITS == 64)				\
> > +      q = (nl >> 6) | (nh << (GMP_LIMB_BITS - 6));		\
>
> Avoid duplicating this.

Not sure I understand what you mean , the only thing I can think of will only 
work with gcc (i think) ie put the #if UDIV_NEEDS_NORMALIZATION inside the 
#define UDIV_QNN

>
> > +  {
> > +    /* this block is equivalent to
> > +       ralloc = (bsize * GMP_NUMB_BITS - cnt + GMP_NAIL_BITS) * e /
> > GMP_NUMB_BITS + 5; +       MPZ_REALLOC(r,ralloc+rtwos_limbs);
> > +       but without any overflow problems
> > +     */
>
> This is not too pretty, but I suppose there's no alternative.
>

What about the definition of SIZE_T_MAX ? I can't remember  the C definition 
for right shifting a signed number , does it keep its sign ? , or not , or is 
it implementation defined ?

> I wouldn't mind seeing an ASSERT which does the calculation another
> way,  like dividing ULONG_MAX by the bsize stuff to work out a limit
> for the exponent.

again I don't see what you getting at , a limit for the exponent would tell us 
what ?





More information about the gmp-bugs mailing list