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

Method pow5

Source/external/fast_float.h:2395–2424  ·  view source on GitHub ↗

multiply as if by 5 raised to a power.

Source from the content-addressed store, hash-verified

2393
2394 // multiply as if by 5 raised to a power.
2395 FASTFLOAT_CONSTEXPR20 bool pow5(uint32_t exp) noexcept {
2396 // multiply by a power of 5
2397 size_t large_length = sizeof(large_power_of_5) / sizeof(limb);
2398 limb_span large = limb_span(large_power_of_5, large_length);
2399 while (exp >= large_step) {
2400 FASTFLOAT_TRY(large_mul(vec, large));
2401 exp -= large_step;
2402 }
2403#ifdef FASTFLOAT_64BIT_LIMB
2404 uint32_t small_step = 27;
2405 limb max_native = 7450580596923828125UL;
2406#else
2407 uint32_t small_step = 13;
2408 limb max_native = 1220703125U;
2409#endif
2410 while (exp >= small_step) {
2411 FASTFLOAT_TRY(small_mul(vec, max_native));
2412 exp -= small_step;
2413 }
2414 if (exp != 0) {
2415 // Work around clang bug https://godbolt.org/z/zedh7rrhc
2416 // This is similar to https://github.com/llvm/llvm-project/issues/47746,
2417 // except the workaround described there don't work here
2418 FASTFLOAT_TRY(
2419 small_mul(vec, limb(((void)small_power_of_5[0], small_power_of_5[exp])))
2420 );
2421 }
2422
2423 return true;
2424 }
2425
2426 // multiply as if by 10 raised to a power.
2427 FASTFLOAT_CONSTEXPR20 bool pow10(uint32_t exp) noexcept {

Callers 1

Calls 2

large_mulFunction · 0.85
small_mulFunction · 0.85

Tested by

no test coverage detected