std.stdint

D constrains integral types to specific sizes. But efficiency of different sizes varies from machine to machine, pointer sizes vary, and the maximum integer size varies. <b>stdint</b> offers a portable way of trading off size vs efficiency, in a manner compatible with the <tt>stdint.h</tt> definitions in C.

In the table below, the exact aliases are types of exactly the specified number of bits. The at least aliases are at least the specified number of bits large, and can be larger. The fast aliases are the fastest integral type supported by the processor that is at least as wide as the specified number of bits.

The aliases are:

Exact AliasDescriptionAt Least AliasDescriptionFast AliasDescription
int8_texactly 8 bits signedint_least8_tat least 8 bits signedint_fast8_tfast 8 bits signed
uint8_texactly 8 bits unsigneduint_least8_tat least 8 bits unsigneduint_fast8_tfast 8 bits unsigned
int16_texactly 16 bits signedint_least16_tat least 16 bits signedint_fast16_tfast 16 bits signed
uint16_texactly 16 bits unsigneduint_least16_tat least 16 bits unsigneduint_fast16_tfast 16 bits unsigned
int32_texactly 32 bits signedint_least32_tat least 32 bits signedint_fast32_tfast 32 bits signed
uint32_texactly 32 bits unsigneduint_least32_tat least 32 bits unsigneduint_fast32_tfast 32 bits unsigned
int64_texactly 64 bits signedint_least64_tat least 64 bits signedint_fast64_tfast 64 bits signed
uint64_texactly 64 bits unsigneduint_least64_tat least 64 bits unsigneduint_fast64_tfast 64 bits unsigned

The ptr aliases are integral types guaranteed to be large enough to hold a pointer without losing bits:

AliasDescription
intptr_tsigned integral type large enough to hold a pointer
uintptr_tunsigned integral type large enough to hold a pointer

The max aliases are the largest integral types:

AliasDescription
intmax_tthe largest signed integral type
uintmax_tthe largest unsigned integral type

Public Imports

core.stdc.stdint
public import core.stdc.stdint;

Meta