/*
Copyright (C) 2009, 2011 William Hart
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See .
*/
#include "gmp.h"
#include "flint.h"
#include "fft.h"
#include "longlong.h"
#include "ulong_extras.h"
#include "fft_tuning.h"
#include "mpn_extras.h"
static mp_size_t mulmod_2expp1_table_n[FFT_N_NUM] = MULMOD_TAB;
void fft_naive_convolution_1(mp_limb_t * r, mp_limb_t * ii, mp_limb_t * jj, mp_size_t m)
{
mp_size_t i, j;
for (i = 0; i < m; i++)
r[i] = ii[0]*jj[i];
for (i = 1; i < m; i++)
{
for (j = 0; j < m - i; j++)
r[i+j] += ii[i]*jj[j];
for ( ; j < m; j++)
r[i+j-m] -=ii[i]*jj[j];
}
}
void _fft_mulmod_2expp1(mp_limb_t * r1, mp_limb_t * i1, mp_limb_t * i2,
mp_size_t r_limbs, flint_bitcnt_t depth, flint_bitcnt_t w)
{
mp_size_t n = (UWORD(1)<