--- urandomb.c Mon Apr 15 14:51:09 2002 +++ urandomb.c.new Wed Mar 12 18:05:40 2003 @@ -60,13 +60,16 @@ exp--; } - count_leading_zeros (cnt, rp[nlimbs - 1]); - if (cnt) mpn_lshift (rp, rp, nlimbs, cnt); - exp -= cnt; + if (nlimbs != 0) /* otherwise value is zero */ + { + count_leading_zeros (cnt, rp[nlimbs - 1]); + if (cnt) mpn_lshift (rp, rp, nlimbs, cnt); + exp -= cnt; - cnt = nlimbs*BITS_PER_MP_LIMB - nbits; - /* cnt is the number of non significant bits in the low limb */ - rp[0] &= ~((MP_LIMB_T_ONE << cnt) - 1); + cnt = nlimbs*BITS_PER_MP_LIMB - nbits; + /* cnt is the number of non significant bits in the low limb */ + rp[0] &= ~((MP_LIMB_T_ONE << cnt) - 1); + } MPFR_EXP (rop) = exp; }