File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -282,12 +282,15 @@ namespace cp_algo::math::fft {
282282 }
283283 cp_algo::checkpoint (" mod join" );
284284 }
285+ auto make_copy (auto &&x) {
286+ return x;
287+ }
285288 void cyclic_mul (auto &a, auto const & b, size_t k) {
286289 return cyclic_mul (a, make_copy (b), k);
287290 }
288291 void mul (auto &a, auto &&b) {
289292 size_t N = size (a) + size (b) - 1 ;
290- if (N > (1 << 19 )) {
293+ if (N > (1 << 19 )) {
291294 size_t NN = std::bit_ceil (N);
292295 a.resize (NN);
293296 b.resize (NN);
@@ -298,7 +301,12 @@ namespace cp_algo::math::fft {
298301 }
299302 }
300303 void mul (auto &a, auto const & b) {
301- mul (a, make_copy (b));
304+ size_t N = size (a) + size (b) - 1 ;
305+ if (N > (1 << 19 )) {
306+ mul (a, make_copy (b));
307+ } else {
308+ mul_truncate (a, b, N);
309+ }
302310 }
303311}
304312#endif // CP_ALGO_MATH_FFT_HPP
You can’t perform that action at this time.
0 commit comments