On Wednesday, April 30th, 2025 at 11:11 AM, Jan Schultke <janschultke@googlemail.com> wrote:
I don't think it makes much sense to use _BitInt for this, even if it was in the standard, which it isn't.

We will reference C23 soon, so it is.


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.
_______________________________________________