Skip to content

Commit

Permalink
minor updates to FFT code
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianGladman committed Jan 21, 2012
1 parent fb4e53c commit f8048b4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fft/butterfly_lshB.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void butterfly_lshB(mp_ptr t, mp_ptr u, mp_ptr i1,
if (x == 0)
{
if (y == 0)
mpn_sumdiff_n(t + x, u + y, i1, i2, limbs + 1);
cy = mpn_sumdiff_n(t + x, u + y, i1, i2, limbs + 1);
else
{
cy = mpn_sumdiff_n(t, u + y, i1, i2, limbs - y);
Expand Down
5 changes: 3 additions & 2 deletions fft/butterfly_rshB.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ void butterfly_rshB(mp_ptr t, mp_ptr u, mp_ptr i1,
{
if (y == 0)
{
mpn_sumdiff_n(t, u, i1, i2, limbs + 1);
} else /* y != 0 */
cy = mpn_sumdiff_n(t, u, i1, i2, limbs + 1);
}
else /* y != 0 */
{
cy = mpn_sumdiff_n(t, u, i1, i2 + y, limbs - y);
cy1 = (cy>>1);
Expand Down
2 changes: 1 addition & 1 deletion fft/mulmod_2expp1.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ gmp_si fft_adjust_limbs(mp_size_t limbs)

if (limbs <= FFT_MULMOD_2EXPP1_CUTOFF) return limbs;

while ((((gmp_si)1)<<depth)<limbs) depth++;
while ((((gmp_ui)1)<<depth)<limbs) depth++;
limbs2 = (((gmp_si)1)<<depth); /* within a factor of 2 of limbs */
bits2 = limbs2*GMP_LIMB_BITS;

Expand Down
2 changes: 2 additions & 0 deletions mpn/generic/mulmod_2expp1_basecase.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ mpn_mulmod_2expp1_basecase (mp_ptr xp, mp_srcptr yp, mp_srcptr zp, int c,
ASSERT (k == 0 || yp[n - 1] >> (GMP_NUMB_BITS - k) == 0);
ASSERT (k == 0 || zp[n - 1] >> (GMP_NUMB_BITS - k) == 0);
#if WANT_ASSERT
{
mp_size_t t;
t = n;
MPN_NORMALIZE (yp, t);
ASSERT (cy == 0 || t == 0);
t = n;
MPN_NORMALIZE (zp, t);
ASSERT (cz == 0 || t == 0);
}
#endif
if (LIKELY (cy == 0))
{
Expand Down
2 changes: 1 addition & 1 deletion tune/tune-fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ main(void)
i2[int_limbs] = 0;

depth1 = 1;
while ((1UL<<depth1) < bits) depth1++;
while ((((mp_limb_t)1)<<depth1) < bits) depth1++;
depth1 = depth1/2;

w1 = bits/(((mp_limb_t)1)<<(2*depth1));
Expand Down

0 comments on commit f8048b4

Please sign in to comment.