MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / long_mul

Function long_mul

external/include/fast_float/fast_float.h:1968–1992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1966// grade-school multiplication algorithm
1967template <uint16_t size>
1968bool long_mul(stackvec<size>& x, limb_span y) noexcept {
1969 limb_span xs = limb_span(x.data, x.len());
1970 stackvec<size> z(xs);
1971 limb_span zs = limb_span(z.data, z.len());
1972
1973 if (y.len() != 0) {
1974 limb y0 = y[0];
1975 FASTFLOAT_TRY(small_mul(x, y0));
1976 for (size_t index = 1; index < y.len(); index++) {
1977 limb yi = y[index];
1978 stackvec<size> zi;
1979 if (yi != 0) {
1980 // re-use the same buffer throughout
1981 zi.set_len(0);
1982 FASTFLOAT_TRY(zi.try_extend(zs));
1983 FASTFLOAT_TRY(small_mul(zi, yi));
1984 limb_span zis = limb_span(zi.data, zi.len());
1985 FASTFLOAT_TRY(large_add_from(x, zis, index));
1986 }
1987 }
1988 }
1989
1990 x.normalize();
1991 return true;
1992}
1993
1994// grade-school multiplication algorithm
1995template <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