blob: 476c42f08ee456c89a94957986c29cd50c3d025f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
|
/**
* D header file for C99.
*
* $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_stdint.h.html, _stdint.h)
*
* Copyright: Copyright Sean Kelly 2005 - 2018
* License: Distributed under the
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
* (See accompanying file LICENSE)
* Authors: Sean Kelly
* Source: $(DRUNTIMESRC core/stdc/_stdint.d)
* Standards: ISO/IEC 9899:1999 (E)
*/
module core.stdc.stdint;
import core.stdc.config;
import core.stdc.stddef; // for wchar_t
import core.stdc.signal; // for sig_atomic_t
import core.stdc.wchar_; // for wint_t
version (OSX)
version = Darwin;
else version (iOS)
version = Darwin;
else version (TVOS)
version = Darwin;
else version (WatchOS)
version = Darwin;
// Can't be `private` because of @@@BUG11173@@@.
T _typify(T)(T val) @safe pure nothrow { return val; }
extern (C):
@trusted: // Types and constants only.
nothrow:
@nogc:
static if (is(ucent))
{
alias int128_t = cent; ///
alias uint128_t = ucent; ///
}
version (Windows)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
version (CRuntime_DigitalMars)
{
alias int32_t = cpp_long; ///
alias uint32_t = cpp_ulong; ///
}
else
{
alias int32_t = int; ///
alias uint32_t = uint; ///
}
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int32_t; ///
alias uint_least32_t = uint32_t; ///
alias int_least64_t = long; ///
alias uint_least64_t = ulong; ///
alias int_fast8_t = byte; ///
alias uint_fast8_t = ubyte; ///
version (MinGW)
{
alias int_fast16_t = short; ///
alias uint_fast16_t = ushort; ///
}
else
{
alias int_fast16_t = int; ///
alias uint_fast16_t = uint; ///
}
alias int_fast32_t = int32_t; ///
alias uint_fast32_t = uint32_t; ///
alias int_fast64_t = long; ///
alias uint_fast64_t = ulong; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (Darwin)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = cpp_longlong; ///
alias uint64_t = cpp_ulonglong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = int64_t; ///
alias uint_least64_t = uint64_t; ///
alias int_fast8_t = byte; ///
alias uint_fast8_t = ubyte; ///
alias int_fast16_t = short; ///
alias uint_fast16_t = ushort; ///
alias int_fast32_t = int; ///
alias uint_fast32_t = uint; ///
alias int_fast64_t = int64_t; ///
alias uint_fast64_t = uint64_t; ///
alias intptr_t = cpp_long; ///
alias uintptr_t = cpp_ulong; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (linux)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = long; ///
alias uint_least64_t = ulong; ///
version (CRuntime_Musl)
{
alias int_fast8_t = byte; ///
alias uint_fast8_t = ubyte; ///
alias int_fast16_t = int; ///
alias uint_fast16_t = uint; ///
alias int_fast32_t = int; ///
alias uint_fast32_t = uint; ///
}
else
{
alias int_fast8_t = byte; ///
alias uint_fast8_t = ubyte; ///
alias int_fast16_t = ptrdiff_t; ///
alias uint_fast16_t = size_t; ///
alias int_fast32_t = ptrdiff_t; ///
alias uint_fast32_t = size_t; ///
}
alias int_fast64_t = long; ///
alias uint_fast64_t = ulong; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (CRuntime_Glibc)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = long; ///
alias uint_least64_t = ulong; ///
alias int_fast8_t = byte; ///
alias uint_fast8_t = ubyte; ///
alias int_fast16_t = ptrdiff_t; ///
alias uint_fast16_t = size_t; ///
alias int_fast32_t = ptrdiff_t; ///
alias uint_fast32_t = size_t; ///
alias int_fast64_t = long; ///
alias uint_fast64_t = ulong; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (DragonFlyBSD)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = int8_t; ///
alias uint_least8_t = uint8_t; ///
alias int_least16_t = int16_t; ///
alias uint_least16_t = uint16_t; ///
alias int_least32_t = int32_t; ///
alias uint_least32_t = uint32_t; ///
alias int_least64_t = int64_t; ///
alias uint_least64_t = uint64_t; ///
alias int_fast8_t = int32_t; ///
alias uint_fast8_t = uint32_t; ///
alias int_fast16_t = int32_t; ///
alias uint_fast16_t = uint32_t; ///
alias int_fast32_t = int32_t; ///
alias uint_fast32_t = uint32_t; ///
alias int_fast64_t = int64_t; ///
alias uint_fast64_t = uint64_t; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (FreeBSD)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = long; ///
alias uint_least64_t = ulong; ///
alias int_fast8_t = int; ///
alias uint_fast8_t = uint; ///
alias int_fast16_t = int; ///
alias uint_fast16_t = uint; ///
alias int_fast32_t = int; ///
alias uint_fast32_t = uint; ///
alias int_fast64_t = long; ///
alias uint_fast64_t = ulong; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (NetBSD)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = int8_t; ///
alias uint_least8_t = uint8_t; ///
alias int_least16_t = int16_t; ///
alias uint_least16_t = uint16_t; ///
alias int_least32_t = int32_t; ///
alias uint_least32_t = uint32_t; ///
alias int_least64_t = int64_t; ///
alias uint_least64_t = uint64_t; ///
alias int_fast8_t = int32_t; ///
alias uint_fast8_t = uint32_t; ///
alias int_fast16_t = int32_t; ///
alias uint_fast16_t = uint32_t; ///
alias int_fast32_t = int32_t; ///
alias uint_fast32_t = uint32_t; ///
alias int_fast64_t = int64_t; ///
alias uint_fast64_t = uint64_t; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (OpenBSD)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = cpp_longlong; ///
alias uint64_t = cpp_ulonglong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = cpp_longlong; ///
alias uint_least64_t = cpp_ulonglong; ///
alias int_fast8_t = int; ///
alias uint_fast8_t = uint; ///
alias int_fast16_t = int; ///
alias uint_fast16_t = uint; ///
alias int_fast32_t = int; ///
alias uint_fast32_t = uint; ///
alias int_fast64_t = cpp_longlong; ///
alias uint_fast64_t = cpp_ulonglong; ///
alias intptr_t = cpp_long; ///
alias uintptr_t = cpp_ulong; ///
alias intmax_t = cpp_longlong; ///
alias uintmax_t = cpp_ulonglong; ///
}
else version (Solaris)
{
alias int8_t = char; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = char; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = long; ///
alias uint_least64_t = ulong; ///
alias int_fast8_t = char; ///
alias uint_fast8_t = ubyte; ///
alias int_fast16_t = int; ///
alias uint_fast16_t = uint; ///
alias int_fast32_t = int; ///
alias uint_fast32_t = uint; ///
alias int_fast64_t = long; ///
alias uint_fast64_t = ulong; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else version (WASI)
{
alias int8_t = byte; ///
alias int16_t = short; ///
alias uint8_t = ubyte; ///
alias uint16_t = ushort; ///
alias int32_t = int; ///
alias uint32_t = uint; ///
alias int64_t = long; ///
alias uint64_t = ulong; ///
alias int_least8_t = byte; ///
alias uint_least8_t = ubyte; ///
alias int_least16_t = short; ///
alias uint_least16_t = ushort; ///
alias int_least32_t = int; ///
alias uint_least32_t = uint; ///
alias int_least64_t = long; ///
alias uint_least64_t = ulong; ///
alias int_fast8_t = byte; ///
alias uint_fast8_t = ubyte; ///
alias int_fast16_t = ptrdiff_t; ///
alias uint_fast16_t = size_t; ///
alias int_fast32_t = ptrdiff_t; ///
alias uint_fast32_t = size_t; ///
alias int_fast64_t = long; ///
alias uint_fast64_t = ulong; ///
alias intptr_t = ptrdiff_t; ///
alias uintptr_t = size_t; ///
alias intmax_t = long; ///
alias uintmax_t = ulong; ///
}
else
{
static assert(false, "Unsupported architecture.");
}
///
enum int8_t INT8_MIN = int8_t.min;
///
enum int8_t INT8_MAX = int8_t.max;
///
enum int16_t INT16_MIN = int16_t.min;
///
enum int16_t INT16_MAX = int16_t.max;
///
enum int32_t INT32_MIN = int32_t.min;
///
enum int32_t INT32_MAX = int32_t.max;
///
enum int64_t INT64_MIN = int64_t.min;
///
enum int64_t INT64_MAX = int64_t.max;
///
enum uint8_t UINT8_MAX = uint8_t.max;
///
enum uint16_t UINT16_MAX = uint16_t.max;
///
enum uint32_t UINT32_MAX = uint32_t.max;
///
enum uint64_t UINT64_MAX = uint64_t.max;
///
enum int_least8_t INT_LEAST8_MIN = int_least8_t.min;
///
enum int_least8_t INT_LEAST8_MAX = int_least8_t.max;
///
enum int_least16_t INT_LEAST16_MIN = int_least16_t.min;
///
enum int_least16_t INT_LEAST16_MAX = int_least16_t.max;
///
enum int_least32_t INT_LEAST32_MIN = int_least32_t.min;
///
enum int_least32_t INT_LEAST32_MAX = int_least32_t.max;
///
enum int_least64_t INT_LEAST64_MIN = int_least64_t.min;
///
enum int_least64_t INT_LEAST64_MAX = int_least64_t.max;
///
enum uint_least8_t UINT_LEAST8_MAX = uint_least8_t.max;
///
enum uint_least16_t UINT_LEAST16_MAX = uint_least16_t.max;
///
enum uint_least32_t UINT_LEAST32_MAX = uint_least32_t.max;
///
enum uint_least64_t UINT_LEAST64_MAX = uint_least64_t.max;
///
enum int_fast8_t INT_FAST8_MIN = int_fast8_t.min;
///
enum int_fast8_t INT_FAST8_MAX = int_fast8_t.max;
///
enum int_fast16_t INT_FAST16_MIN = int_fast16_t.min;
///
enum int_fast16_t INT_FAST16_MAX = int_fast16_t.max;
///
enum int_fast32_t INT_FAST32_MIN = int_fast32_t.min;
///
enum int_fast32_t INT_FAST32_MAX = int_fast32_t.max;
///
enum int_fast64_t INT_FAST64_MIN = int_fast64_t.min;
///
enum int_fast64_t INT_FAST64_MAX = int_fast64_t.max;
///
enum uint_fast8_t UINT_FAST8_MAX = uint_fast8_t.max;
///
enum uint_fast16_t UINT_FAST16_MAX = uint_fast16_t.max;
///
enum uint_fast32_t UINT_FAST32_MAX = uint_fast32_t.max;
///
enum uint_fast64_t UINT_FAST64_MAX = uint_fast64_t.max;
///
enum intptr_t INTPTR_MIN = intptr_t.min;
///
enum intptr_t INTPTR_MAX = intptr_t.max;
///
enum uintptr_t UINTPTR_MIN = uintptr_t.min;
///
enum uintptr_t UINTPTR_MAX = uintptr_t.max;
///
enum intmax_t INTMAX_MIN = intmax_t.min;
///
enum intmax_t INTMAX_MAX = intmax_t.max;
///
enum uintmax_t UINTMAX_MAX = uintmax_t.max;
///
enum ptrdiff_t PTRDIFF_MIN = ptrdiff_t.min;
///
enum ptrdiff_t PTRDIFF_MAX = ptrdiff_t.max;
///
enum sig_atomic_t SIG_ATOMIC_MIN = sig_atomic_t.min;
///
enum sig_atomic_t SIG_ATOMIC_MAX = sig_atomic_t.max;
///
enum size_t SIZE_MAX = size_t.max;
///
enum wchar_t WCHAR_MIN = wchar_t.min;
///
enum wchar_t WCHAR_MAX = wchar_t.max;
///
enum wint_t WINT_MIN = wint_t.min;
///
enum wint_t WINT_MAX = wint_t.max;
///
alias INT8_C = _typify!int8_t ;
///
alias INT16_C = _typify!int16_t;
///
alias INT32_C = _typify!int32_t;
///
alias INT64_C = _typify!int64_t;
///
alias UINT8_C = _typify!uint8_t ;
///
alias UINT16_C = _typify!uint16_t;
///
alias UINT32_C = _typify!uint32_t;
///
alias UINT64_C = _typify!uint64_t;
///
alias INTMAX_C = _typify!intmax_t ;
///
alias UINTMAX_C = _typify!uintmax_t;
|