C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] Standardizing a limb/word type (uint_maxfast_t/uint_word_t)

From: Jₑₙₛ Gustedt <jens.gustedt_at_[hidden]>
Date: Sun, 23 Aug 2026 06:23:48 -0400
Jan,

on Sun, 23 Aug 2026 07:25:26 +0200 you (Jan Schultke via Liaison
<liaison_at_[hidden]>) wrote:

> When working on a draft of P4444 std::big_int (
> https://isocpp.org/files/papers/D4444R0.html#std::uint_multiprecision_t),
> we've stumbled upon the problem that C++ does not yet have a "word
> type" that would be suitable as the "limb type" for multiprecision.
> That is, the largest possible unsigned integer type that has native
> arithmetic support.

As Nevin mentionned the `intmax_t` trap, it would definitively be good
to avoid yet another such ABI trap. So maybe leave such details opaque
to the user and only export something like a

```
struct {
       size_t len;
       /* maybe other members, e.g. sign */
       alignas(something) unsigned char[];
};
```

as a resizable storage container (with `realloc` or so) for these
things.

> For the most part, std::size_t coincidentally has the right size, but
> e.g. on WASM32, std::size_t is 32-bit while there are i64 hardware
> instructions for arithmetic. Every existing integer type (alias) has
> the wrong size, either by design or due to historical reasons.
>
> I'm thus interested in standardizing a type alias in <stdint.h> that
> has the size. In P4444, we call that uint_multiprecision_t, but
> that's perhaps not universal enough. Names like "uint_maxfast_t" or
> "uint_word_t" come to mind.
>
> What are your thoughts?

I think that a bigint type would be good to have in C. But it should
be an opaque library type, first, without extending C's arithmetic
operators. If that works, we could integrate it more closely into the
language, later.

> Also, since I'm not in the C committee
> myself, is there anyone who is interested in championing a proposal
> on the WG14 side?

Unfortunately I would not have the bandwidth for this, sorry.

Jₑₙₛ

-- 
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA antenne de Strasbourg :::::::::::::::::: Camus ::
:: INRIA PIQ program Strasbourg :::::::::: piq.inria.fr ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2026-08-23 10:23:57