C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Extended precision integers

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 26 Nov 2025 07:47:48 -0800
On Wednesday, 26 November 2025 01:16:27 Pacific Standard Time David Brown via
Std-Proposals wrote:
> (It is also entirely reasonable to suppose that specific
> 128-bit integers might be supported more efficiently than arbitrary
> sized _BitInt types.)

int128_t should be supported exactly as efficiently as _BitInt(128), no faster
and no slower, because it should *be exactly the same support*. Different
types, but since it's exactly the same size and behaviour, it should be using
the exact same implementation. Like long with either int or long long. Yes,
this is a QoI, but it's an easy fix for a compiler to specifically detect that
the _BitInt has the same size as another integer it already supports, one I
expect all compilers to do and also one I expect users to request if not.

Other _BitInt sizes, including smaller ones, could have worse performance.
It's up to the user to determine a size that meets their needs and achieves
the performance they require.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2025-11-26 15:47:58