Date: Thu, 15 Jan 2026 05:56:23 -0800
On Thursday, 15 January 2026 00:53:07 Pacific Standard Time Hans Ã…berg wrote:
> > All _BitInt of a power of 2 have exactly that size, with no padding bits.
> > Therefore, _BitInt(256) or _BitInt(65536) *can* be as efficient as your
> > code.
> >
> > _BitInt(4096) has exactly 4096 bits. Are you claiming that to get the best
> > performance, it should be padded up to 65536 bits, the next power of 2
> > raised to a power of 2 (k = 4)?
>
> The number 2^(2^k) is the modulus; the number of bits is 2^k.
Ah, ok. Sorry.
So this means _BitInt(4096) can be optimal. Therefore, we're not seeing any
point in your proposal.
I do note _BitInt(4088) and _BitInt(4097) will not. This is not a limitation
of the Standard, but a *choice* by the implementations to pad up to
sizeof(void*), not a power of 2.
> > All _BitInt of a power of 2 have exactly that size, with no padding bits.
> > Therefore, _BitInt(256) or _BitInt(65536) *can* be as efficient as your
> > code.
> >
> > _BitInt(4096) has exactly 4096 bits. Are you claiming that to get the best
> > performance, it should be padded up to 65536 bits, the next power of 2
> > raised to a power of 2 (k = 4)?
>
> The number 2^(2^k) is the modulus; the number of bits is 2^k.
Ah, ok. Sorry.
So this means _BitInt(4096) can be optimal. Therefore, we're not seeing any
point in your proposal.
I do note _BitInt(4088) and _BitInt(4097) will not. This is not a limitation
of the Standard, but a *choice* by the implementations to pad up to
sizeof(void*), not a power of 2.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-01-15 13:56:27
