fix ; set zero if p[] == 0

dev
MITSUNARI Shigeo 9 years ago
parent 12269291fc
commit 1f9783ce1c
  1. 7
      src/fp.cpp

@ -75,8 +75,13 @@ struct OpeFunc {
static const size_t N = (bitSize + UnitBitSize - 1) / UnitBitSize;
static inline void set_mpz_t(mpz_t& z, const Unit* p, int n = (int)N)
{
int s = n;
while (s > 0) {
if (p[s - 1]) break;
s--;
}
z->_mp_alloc = n;
z->_mp_size = (int)getNonZeroArraySize(p, n);
z->_mp_size = s;
z->_mp_d = (mp_limb_t*)const_cast<Unit*>(p);
}
static inline void set_zero(mpz_t& z, Unit *p, size_t n)

Loading…
Cancel
Save