MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / full_multiplication

Function full_multiplication

Source/external/fast_float.h:381–404  ·  view source on GitHub ↗

compute 64-bit a*b

Source from the content-addressed store, hash-verified

379
380// compute 64-bit a*b
381fastfloat_really_inline FASTFLOAT_CONSTEXPR20
382value128 full_multiplication(uint64_t a, uint64_t b) {
383 if (cpp20_and_in_constexpr()) {
384 value128 answer;
385 answer.low = umul128_generic(a, b, &answer.high);
386 return answer;
387 }
388 value128 answer;
389#if defined(_M_ARM64) && !defined(__MINGW32__)
390 // ARM64 has native support for 64-bit multiplications, no need to emulate
391 // But MinGW on ARM64 doesn't have native support for 64-bit multiplications
392 answer.high = __umulh(a, b);
393 answer.low = a * b;
394#elif defined(FASTFLOAT_32BIT) || (defined(_WIN64) && !defined(__clang__))
395 answer.low = _umul128(a, b, &answer.high); // _umul128 not available on ARM64
396#elif defined(FASTFLOAT_64BIT)
397 __uint128_t r = ((__uint128_t)a) * b;
398 answer.low = uint64_t(r);
399 answer.high = uint64_t(r >> 64);
400#else
401 answer.low = umul128_generic(a, b, &answer.high);
402#endif
403 return answer;
404}
405
406struct adjusted_mantissa {
407 uint64_t mantissa{0};

Callers 2

scalar_mulFunction · 0.85

Calls 3

cpp20_and_in_constexprFunction · 0.85
umul128_genericFunction · 0.85
_umul128Function · 0.85

Tested by

no test coverage detected