set zero for output when bits = 0

This commit is contained in:
gladman 2012-01-17 17:49:00 +00:00
parent 7c55450bb2
commit 6880d37a07

View File

@ -46,9 +46,12 @@ int mpn_mulmod_2expp1(mp_ptr r, mp_srcptr i1, mp_srcptr i2, mp_size_t n, mp_size
if (limbs <= FFT_MULMOD_2EXPP1_CUTOFF) if (limbs <= FFT_MULMOD_2EXPP1_CUTOFF)
#endif #endif
{ {
mp_limb_t c = 2 * i1[limbs] + i2[limbs]; mp_limb_t c = 2 * i1[limbs] + i2[limbs];
r[limbs] = mpn_mulmod_2expp1_basecase(r, i1, i2, c, bits, tt); if(bits)
return r[limbs]; r[limbs] = mpn_mulmod_2expp1_basecase(r, i1, i2, c, bits, tt);
else
r[limbs] = 0;
return r[limbs];
} }
#if !defined( OLD_FFT ) #if !defined( OLD_FFT )
while ((((mp_limb_t)1)<<depth) < bits) depth++; while ((((mp_limb_t)1)<<depth) < bits) depth++;