mini-gmp.c mpz_import still has a bug

shuax admin at shuax.com
Sat Jan 5 16:02:01 CET 2013


    In the mini-gmp, calculate word_step by this way:
      if (order == 1)
        {
          p += size * (count - 1);
          word_step = -(ptrdiff_t) size;
        }
      else
        word_step = size;
    and in the full version calculate woffset by this way:
        numb = size * 8 - nail;
        woffset = (numb + 7) / 8;
        woffset = (endian >= 0 ? woffset : -woffset)
          + (order < 0 ? size : - (mp_size_t) size);
    Here are some different.In short, in the double loop the p pointer
    position is not calculated correctly.
    In addition, the effect of mpz_export compared to the full version is
    also inconsistent.


More information about the gmp-bugs mailing list