# Re: \[PATCH\] uapi: Make \_\_{u,s}64 match {u,}int64\_t in userspace

- List: linux-api
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-api/2021/11/1583242/t

## Re: \[PATCH\] uapi: Make \_\_{u,s}64 match {u,}int64\_t in userspace

- From: Florian Weimer \<hidden\>
- Date: 2021-11-23 19:50:54 
- Message: https://ratatoskr.run/linux-api/2021/11/1583242.md

```text
* Cyril Hrubis:

> As far as I can tell the userspace bits/types.h does exactly the same
> check in order to define uint64_t and int64_t, i.e.:
>
> #if __WORDSIZE == 64
> typedef signed long int __int64_t;
> typedef unsigned long int __uint64_t;
> #else
> __extension__ typedef signed long long int __int64_t;
> __extension__ typedef unsigned long long int __uint64_t;
> #endif
>
> The macro __WORDSIZE is defined per architecture, and it looks like the
> defintions in glibc sources in bits/wordsize.h match the uapi
> asm/bitsperlong.h. But I may have missed something, the code in glibc is
> not exactly easy to read.

__WORDSIZE isn't exactly a standard libc macro.

On musl, x86-64 x32 has __WORDSIZE == 64 depending on header-inclusion
order, but that's probably just a bug.

Thanks,
Florian

```

## Re: \[PATCH\] uapi: Make \_\_{u,s}64 match {u,}int64\_t in userspace

- From: Alejandro Colomar (man-pages) \<hidden\>
- Date: 2021-11-24 10:17:34 
- Message: https://ratatoskr.run/linux-api/2021/11/1583694.md

```text
On 11/23/21 20:50, Florian Weimer via Libc-alpha wrote:
> * Cyril Hrubis:
>
>> As far as I can tell the userspace bits/types.h does exactly the same
>> check in order to define uint64_t and int64_t, i.e.:
>>
>> #if __WORDSIZE == 64
>> typedef signed long int __int64_t;
>> typedef unsigned long int __uint64_t;
>> #else
>> __extension__ typedef signed long long int __int64_t;
>> __extension__ typedef unsigned long long int __uint64_t;
>> #endif
>>
>> The macro __WORDSIZE is defined per architecture, and it looks like the
>> defintions in glibc sources in bits/wordsize.h match the uapi
>> asm/bitsperlong.h. But I may have missed something, the code in glibc is
>> not exactly easy to read.
>
> __WORDSIZE isn't exactly a standard libc macro.

The (to-be) standard libc macro would be LONG_WIDTH (although it has a slightly different meaning, but it can be used for this, but then the code also needs to expose <limits.h>), rigth?

Regards,
Alex

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
```
