[libc-commits] [libc] [llvm] [libc] Provide `LIBC_TYPES_HAS_INT128` (PR #84149)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Mar 6 04:56:08 PST 2024


gchatelet wrote:

> > @lntue should we also provide aliases (`using int128_t = __int128_t`) as we do for `_Float16` et al.?
> > It looks to me like it would be more consistent.
> 
> For us, shall the alias be `uint128` instead, similar to `float16`, just in case `uint128_t` is standardized in the future?

I was suggesting something like the following in `types.h`
```
// int128 / uint128 support
#if defined(__SIZEOF_INT128__)
#define LIBC_TYPES_HAS_INT128
using uint128_t = __uint128_t;
using int128_t = __int128_t;
#endif // defined(__SIZEOF_INT128__)
```

So we could provide both signed and unsigned. The aim is to use them as the other types (i.e., `uint64_t`) whenever they are available.

And yes it would be only for internal usage.

https://github.com/llvm/llvm-project/pull/84149


More information about the libc-commits mailing list