Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why there are int56_t in clang c header file, and how to use them

I noticed that

https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/refs/heads/nougat-mr1-security-release/clang-2690385/lib64/clang/3.8/include/stdint.h#128

#ifdef __INT56_TYPE__
typedef __INT56_TYPE__ int56_t;
typedef __UINT56_TYPE__ uint56_t;
typedef int56_t int_least56_t;
typedef uint56_t uint_least56_t;
typedef int56_t int_fast56_t;
typedef uint56_t uint_fast56_t;

I searched google but find nothing. And it’s even my first time to notice these types.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The comment in that header file before those types (link to GitHub commit adding these) explains:

To accomodate targets that are missing types that are exactly 8, 16, 32, or
64 bits wide, this implementation takes an approach of cascading
redefintions, redefining __int_leastN_t to successively smaller exact-width
types. It is therefore important that the types are defined in order of
descending widths.

Whether such machines exist (anymore?) in the wild is a good question, but LLVM/clang would support them.

In short, to answer "how to use them":

You don’t, unless you have an esoteric machine that defines __INT56_TYPE__.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading