| 1 |
// Written in the D programming language. |
| 2 |
|
| 3 |
/** |
| 4 |
* |
| 5 |
D constrains integral types to specific sizes. But efficiency |
| 6 |
of different sizes varies from machine to machine, |
| 7 |
pointer sizes vary, and the maximum integer size varies. |
| 8 |
<b>stdint</b> offers a portable way of trading off size |
| 9 |
vs efficiency, in a manner compatible with the <tt>stdint.h</tt> |
| 10 |
definitions in C. |
| 11 |
|
| 12 |
In the table below, the $(B exact alias)es are types of exactly the |
| 13 |
specified number of bits. |
| 14 |
The $(B at least alias)es are at least the specified number of bits |
| 15 |
large, and can be larger. |
| 16 |
The $(B fast alias)es are the fastest integral type supported by the |
| 17 |
processor that is at least as wide as the specified number of bits. |
| 18 |
|
| 19 |
The aliases are: |
| 20 |
|
| 21 |
$(ATABLE $(TR |
| 22 |
$(TH Exact Alias) |
| 23 |
$(TH Description) |
| 24 |
$(TH At Least Alias) |
| 25 |
$(TH Description) |
| 26 |
$(TH Fast Alias) |
| 27 |
$(TH Description) |
| 28 |
)$(TR |
| 29 |
$(TD int8_t) |
| 30 |
$(TD exactly 8 bits signed) |
| 31 |
$(TD int_least8_t) |
| 32 |
$(TD at least 8 bits signed) |
| 33 |
$(TD int_fast8_t) |
| 34 |
$(TD fast 8 bits signed) |
| 35 |
)$(TR |
| 36 |
$(TD uint8_t) |
| 37 |
$(TD exactly 8 bits unsigned) |
| 38 |
$(TD uint_least8_t) |
| 39 |
$(TD at least 8 bits unsigned) |
| 40 |
$(TD uint_fast8_t) |
| 41 |
$(TD fast 8 bits unsigned) |
| 42 |
|
| 43 |
)$(TR |
| 44 |
$(TD int16_t) |
| 45 |
$(TD exactly 16 bits signed) |
| 46 |
$(TD int_least16_t) |
| 47 |
$(TD at least 16 bits signed) |
| 48 |
$(TD int_fast16_t) |
| 49 |
$(TD fast 16 bits signed) |
| 50 |
)$(TR |
| 51 |
$(TD uint16_t) |
| 52 |
$(TD exactly 16 bits unsigned) |
| 53 |
$(TD uint_least16_t) |
| 54 |
$(TD at least 16 bits unsigned) |
| 55 |
$(TD uint_fast16_t) |
| 56 |
$(TD fast 16 bits unsigned) |
| 57 |
|
| 58 |
)$(TR |
| 59 |
$(TD int32_t) |
| 60 |
$(TD exactly 32 bits signed) |
| 61 |
$(TD int_least32_t) |
| 62 |
$(TD at least 32 bits signed) |
| 63 |
$(TD int_fast32_t) |
| 64 |
$(TD fast 32 bits signed) |
| 65 |
)$(TR |
| 66 |
$(TD uint32_t) |
| 67 |
$(TD exactly 32 bits unsigned) |
| 68 |
$(TD uint_least32_t) |
| 69 |
$(TD at least 32 bits unsigned) |
| 70 |
$(TD uint_fast32_t) |
| 71 |
$(TD fast 32 bits unsigned) |
| 72 |
|
| 73 |
)$(TR |
| 74 |
$(TD int64_t) |
| 75 |
$(TD exactly 64 bits signed) |
| 76 |
$(TD int_least64_t) |
| 77 |
$(TD at least 64 bits signed) |
| 78 |
$(TD int_fast64_t) |
| 79 |
$(TD fast 64 bits signed) |
| 80 |
)$(TR |
| 81 |
$(TD uint64_t) |
| 82 |
$(TD exactly 64 bits unsigned) |
| 83 |
$(TD uint_least64_t) |
| 84 |
$(TD at least 64 bits unsigned) |
| 85 |
$(TD uint_fast64_t) |
| 86 |
$(TD fast 64 bits unsigned) |
| 87 |
)) |
| 88 |
|
| 89 |
The ptr aliases are integral types guaranteed to be large enough |
| 90 |
to hold a pointer without losing bits: |
| 91 |
|
| 92 |
$(ATABLE $(TR |
| 93 |
$(TH Alias) |
| 94 |
$(TH Description) |
| 95 |
)$(TR |
| 96 |
$(TD intptr_t) |
| 97 |
$(TD signed integral type large enough to hold a pointer) |
| 98 |
)$(TR |
| 99 |
$(TD uintptr_t) |
| 100 |
$(TD unsigned integral type large enough to hold a pointer) |
| 101 |
)) |
| 102 |
|
| 103 |
The max aliases are the largest integral types: |
| 104 |
|
| 105 |
$(ATABLE $(TR |
| 106 |
$(TH Alias) |
| 107 |
$(TH Description) |
| 108 |
)$(TR |
| 109 |
$(TD intmax_t) |
| 110 |
$(TD the largest signed integral type) |
| 111 |
)$(TR |
| 112 |
$(TD uintmax_t) |
| 113 |
$(TD the largest unsigned integral type) |
| 114 |
)) |
| 115 |
|
| 116 |
* Macros: |
| 117 |
* ATABLE=<table border="1" cellspacing="0" cellpadding="5">$0</table> |
| 118 |
* |
| 119 |
* Copyright: Copyright The D Language Foundation 2000 - 2009. |
| 120 |
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). |
| 121 |
* Authors: $(HTTP digitalmars.com, Walter Bright) |
| 122 |
* Source: $(PHOBOSSRC std/stdint.d) |
| 123 |
*/ |
| 124 |
/* Copyright The D Language Foundation 2000 - 2009. |
| 125 |
* Distributed under the Boost Software License, Version 1.0. |
| 126 |
* (See accompanying file LICENSE_1_0.txt or copy at |
| 127 |
* http://www.boost.org/LICENSE_1_0.txt) |
| 128 |
*/ |
| 129 |
module std.stdint; |
| 130 |
|
| 131 |
public import core.stdc.stdint; |