| 3735 | // grade-school multiplication algorithm |
| 3736 | template <uint16_t size> |
| 3737 | FASTFLOAT_CONSTEXPR20 bool long_mul(stackvec<size> &x, limb_span y) noexcept { |
| 3738 | limb_span xs = limb_span(x.data, x.len()); |
| 3739 | stackvec<size> z(xs); |
| 3740 | limb_span zs = limb_span(z.data, z.len()); |
| 3741 | |
| 3742 | if (y.len() != 0) { |
| 3743 | limb y0 = y[0]; |
| 3744 | FASTFLOAT_TRY(small_mul(x, y0)); |
| 3745 | for (size_t index = 1; index < y.len(); index++) { |
| 3746 | limb yi = y[index]; |
| 3747 | stackvec<size> zi; |
| 3748 | if (yi != 0) { |
| 3749 | // re-use the same buffer throughout |
| 3750 | zi.set_len(0); |
| 3751 | FASTFLOAT_TRY(zi.try_extend(zs)); |
| 3752 | FASTFLOAT_TRY(small_mul(zi, yi)); |
| 3753 | limb_span zis = limb_span(zi.data, zi.len()); |
| 3754 | FASTFLOAT_TRY(large_add_from(x, zis, index)); |
| 3755 | } |
| 3756 | } |
| 3757 | } |
| 3758 | |
| 3759 | x.normalize(); |
| 3760 | return true; |
| 3761 | } |
| 3762 | |
| 3763 | // grade-school multiplication algorithm |
| 3764 | template <uint16_t size> |
no test coverage detected