C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::bit_int

From: Jan Schultke <janschultke_at_[hidden]>
Date: Sun, 16 Feb 2025 00:59:00 +0100
On the note of bit-fields, I think this is a bit far-fetched. The
point of bit-fields is usually to interact with individual bits or
very small groups of them, and you don't need _BitInt for that. I
don't think this is strong motivation in itself.

Maybe I'm missing some obvious use case. Can you elaborate?

On the note of implementation, I don't really understand your
optimization concerns. The Clang C++ implementation is literally just:

template <int N>
struct bit_int {
    _BitInt(N) value;
    // ...
};

Whatever the compiler can do with _BitInt, it can do with a wrapper
for that type. I'm not sure where those padding bits are meant to be
coming from. The padding bits, if any, are in the underlying _BitInt.

Received on 2025-02-15 23:59:15