View source code
Display the source code in std/stdint.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Module 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. stdint offers a portable way of trading off size vs efficiency, in a manner compatible with the stdint.h 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 Alias Description At Least Alias Description Fast Alias Description
int8_t exactly 8 bits signed int_least8_t at least 8 bits signed int_fast8_t fast 8 bits signed
uint8_t exactly 8 bits unsigned uint_least8_t at least 8 bits unsigned uint_fast8_t fast 8 bits unsigned
int16_t exactly 16 bits signed int_least16_t at least 16 bits signed int_fast16_t fast 16 bits signed
uint16_t exactly 16 bits unsigned uint_least16_t at least 16 bits unsigned uint_fast16_t fast 16 bits unsigned
int32_t exactly 32 bits signed int_least32_t at least 32 bits signed int_fast32_t fast 32 bits signed
uint32_t exactly 32 bits unsigned uint_least32_t at least 32 bits unsigned uint_fast32_t fast 32 bits unsigned
int64_t exactly 64 bits signed int_least64_t at least 64 bits signed int_fast64_t fast 64 bits signed
uint64_t exactly 64 bits unsigned uint_least64_t at least 64 bits unsigned uint_fast64_t fast 64 bits unsigned

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

Alias Description
intptr_t signed integral type large enough to hold a pointer
uintptr_t unsigned integral type large enough to hold a pointer

The max aliases are the largest integral types:

Alias Description
intmax_t the largest signed integral type
uintmax_t the largest unsigned integral type

Authors

Walter Bright

License

Boost License 1.0.