gmp-4.1.2 assertion failure

Kevin Ryde user42 at zip.com.au
Tue Feb 17 10:53:19 CET 2004


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.

> +  {
> +    /* 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.

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.


More information about the gmp-bugs mailing list