summaryrefslogtreecommitdiff
path: root/firmware/libc/include/stdint.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/libc/include/stdint.h')
-rw-r--r--firmware/libc/include/stdint.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/firmware/libc/include/stdint.h b/firmware/libc/include/stdint.h
new file mode 100644
index 0000000000..93f234c0e8
--- /dev/null
+++ b/firmware/libc/include/stdint.h
@@ -0,0 +1,107 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef __STDINT_H__
23#define __STDINT_H__
24
25#include <limits.h>
26
27/* 8 bit */
28#define INT8_MIN SCHAR_MIN
29#define INT8_MAX SCHAR_MAX
30#define UINT8_MAX UCHAR_MAX
31#define int8_t signed char
32#define uint8_t unsigned char
33
34/* 16 bit */
35#if USHRT_MAX == 0xffff
36
37#define INT16_MIN SHRT_MIN
38#define INT16_MAX SHRT_MAX
39#define UINT16_MAX USHRT_MAX
40#define int16_t short
41#define uint16_t unsigned short
42
43#endif
44
45/* 32 bit */
46#if ULONG_MAX == 0xfffffffful
47
48#define INT32_MIN LONG_MIN
49#define INT32_MAX LONG_MAX
50#define UINT32_MAX ULONG_MAX
51#define int32_t long
52#define uint32_t unsigned long
53
54#define INTPTR_MIN LONG_MIN
55#define INTPTR_MAX LONG_MAX
56#define UINTPTR_MAX ULONG_MAX
57#define intptr_t long
58#define uintptr_t unsigned long
59
60#elif UINT_MAX == 0xffffffffu
61
62#define INT32_MIN INT_MIN
63#define INT32_MAX INT_MAX
64#define UINT32_MAX UINT_MAX
65#define int32_t int
66#define uint32_t unsigned int
67
68#endif
69
70/* 64 bit */
71#ifndef LLONG_MIN
72#define LLONG_MIN ((long long)9223372036854775808ull)
73#endif
74
75#ifndef LLONG_MAX
76#define LLONG_MAX 9223372036854775807ll
77#endif
78
79#ifndef ULLONG_MAX
80#define ULLONG_MAX 18446744073709551615ull
81#endif
82
83#if ULONG_MAX == 0xffffffffffffffffull
84
85#define INT64_MIN LONG_MIN
86#define INT64_MAX LONG_MAX
87#define UINT64_MAX ULONG_MAX
88#define int64_t long
89#define uint64_t unsigned long
90
91#define INTPTR_MIN LONG_MIN
92#define INTPTR_MAX LONG_MAX
93#define UINTPTR_MAX ULONG_MAX
94#define intptr_t long
95#define uintptr_t unsigned long
96
97#else
98
99#define INT64_MIN LLONG_MIN
100#define INT64_MAX LLONG_MAX
101#define UINT64_MAX ULLONG_MAX
102#define int64_t long long
103#define uint64_t unsigned long long
104
105#endif
106
107#endif /* __STDINT_H__ */