We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d03521 commit f57d518Copy full SHA for f57d518
cp-algo/math/fft.hpp
@@ -289,23 +289,24 @@ namespace cp_algo::math::fft {
289
return cyclic_mul(a, make_copy(b), k);
290
}
291
void mul(auto &a, auto &&b) {
292
- size_t N = size(a) + size(b) - 1;
293
- if(N > (1 << 19)) {
+ size_t N = size(a) + size(b);
+ if(N > (1 << 20)) {
294
+ N--;
295
size_t NN = std::bit_ceil(N);
296
a.resize(NN);
297
b.resize(NN);
298
cyclic_mul(a, b, NN);
299
a.resize(N);
300
} else {
- mul_truncate(a, b, N);
301
+ mul_truncate(a, b, N - 1);
302
303
304
void mul(auto &a, auto const& b) {
305
306
307
mul(a, make_copy(b));
308
309
310
311
312
0 commit comments