You wouldn't need to parse in this function; the two byte spans would contain the little-endian bits of the variable-length integers that make up the integer and fraction. I don't see a compelling reason why you would take in the integer and fraction as an integer type. You're still passing the same data.
Oh, I see. We originate from the same idea.
As a side note, std::span<const std::byte>
could be used to make this clearer.
If we further talk about variable length
bits vs. fixed-length bits (_BitInt(K) or
std::array<std::byte>), I slightly prefer the latter
because when comes to to_chars, there is
some advantage to exchange the data
via return value, in which case span
can't be reused as it defines no storage.
Regardless this is less important than the
point: no parse and no format.
--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________