MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / long_mul

Function long_mul

app/src/ThirdParty/fast_float.h:3737–3761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3735// grade-school multiplication algorithm
3736template <uint16_t size>
3737FASTFLOAT_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
3764template <uint16_t size>

Callers 1

large_mulFunction · 0.85

Calls 6

small_mulFunction · 0.85
large_add_fromFunction · 0.85
set_lenMethod · 0.80
try_extendMethod · 0.80
lenMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected