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

Function parse_eight_digits_unrolled

app/src/ThirdParty/fast_float.h:1816–1825  ·  view source on GitHub ↗

credit @aqrit

Source from the content-addressed store, hash-verified

1814
1815// credit @aqrit
1816fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t
1817parse_eight_digits_unrolled(uint64_t val) {
1818 uint64_t const mask = 0x000000FF000000FF;
1819 uint64_t const mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32)
1820 uint64_t const mul2 = 0x0000271000000001; // 1 + (10000ULL << 32)
1821 val -= 0x3030303030303030;
1822 val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8;
1823 val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32;
1824 return uint32_t(val);
1825}
1826
1827// Call this if chars are definitely 8 digits.
1828template <typename UC>

Callers 3

parse_eight_digitsFunction · 0.85

Calls 3

cpp20_and_in_constexprFunction · 0.85
read8_to_u64Function · 0.85
simd_read8_to_u64Function · 0.85

Tested by

no test coverage detected