summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-10 09:43:06 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-10 09:43:06 +0000
commitaf7780e0b3f27a574b007be6ac7a273d14f6b76a (patch)
treeb1698401c2c8b696b9e1effecdbf6c5705fa08c1
parent13c111aaece4d2bd06c41a55aee4abcb256a2774 (diff)
downloadrockbox-af7780e0b3f27a574b007be6ac7a273d14f6b76a.tar.gz
rockbox-af7780e0b3f27a574b007be6ac7a273d14f6b76a.zip
More complete sized integer definitions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13092 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/include/inttypes.h84
1 files changed, 66 insertions, 18 deletions
diff --git a/firmware/include/inttypes.h b/firmware/include/inttypes.h
index e23e1da960..3737490a81 100644
--- a/firmware/include/inttypes.h
+++ b/firmware/include/inttypes.h
@@ -17,41 +17,89 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#ifndef __INTTYPES_H__ 20#ifndef __INTTYPES_H__
21#define __INTTYPES_H__ 21#define __INTTYPES_H__
22 22
23#include <limits.h> 23#include <limits.h>
24 24
25/* 8 bit */ 25/* 8 bit */
26#define int8_t signed char 26#define INT8_MIN SCHAR_MIN
27#define uint8_t unsigned char 27#define INT8_MAX SCHAR_MAX
28#define UINT8_MAX UCHAR_MAX
29#define int8_t signed char
30#define uint8_t unsigned char
28 31
29/* 16 bit */ 32/* 16 bit */
30#if USHRT_MAX == 0xffff 33#if USHRT_MAX == 0xffff
31#define int16_t short 34
32#define uint16_t unsigned short 35#define INT16_MIN SHRT_MIN
36#define INT16_MAX SHRT_MAX
37#define UINT16_MAX USHRT_MAX
38#define int16_t short
39#define uint16_t unsigned short
40
33#endif 41#endif
34 42
35/* 32 bit */ 43/* 32 bit */
36#if ULONG_MAX == 0xfffffffful 44#if ULONG_MAX == 0xfffffffful
37#define int32_t long 45
38#define uint32_t unsigned long 46#define INT32_MIN LONG_MIN
39#define intptr_t long 47#define INT32_MAX LONG_MAX
40#define uintptr_t unsigned long 48#define UINT32_MAX ULONG_MAX
49#define int32_t long
50#define uint32_t unsigned long
51
52#define INTPTR_MIN LONG_MIN
53#define INTPTR_MAX LONG_MAX
54#define UINTPTR_MAX ULONG_MAX
55#define intptr_t long
56#define uintptr_t unsigned long
57
41#elif UINT_MAX == 0xffffffffu 58#elif UINT_MAX == 0xffffffffu
42#define int32_t int 59
43#define uint32_t unsigned int 60#define INT32_MIN INT_MIN
61#define INT32_MAX INT_MAX
62#define UINT32_MAX UINT_MAX
63#define int32_t int
64#define uint32_t unsigned int
65
44#endif 66#endif
45 67
46/* 64 bit */ 68/* 64 bit */
69#ifndef LLONG_MIN
70#define LLONG_MIN ((long long)9223372036854775808ull)
71#endif
72
73#ifndef LLONG_MAX
74#define LLONG_MAX 9223372036854775807ll
75#endif
76
77#ifndef ULLONG_MAX
78#define ULLONG_MAX 18446744073709551615ull
79#endif
80
47#if ULONG_MAX == 0xffffffffffffffffull 81#if ULONG_MAX == 0xffffffffffffffffull
48#define int64_t long 82
49#define uint64_t unsigned long 83#define INT64_MIN LONG_MIN
50#define intptr_t long 84#define INT64_MAX LONG_MAX
51#define uintptr_t unsigned long 85#define UINT64_MAX ULONG_MAX
86#define int64_t long
87#define uint64_t unsigned long
88
89#define INTPTR_MIN LONG_MIN
90#define INTPTR_MAX LONG_MAX
91#define UINTPTR_MAX ULONG_MAX
92#define intptr_t long
93#define uintptr_t unsigned long
94
52#else 95#else
53#define int64_t long long 96
54#define uint64_t unsigned long long 97#define INT64_MIN LLONG_MIN
98#define INT64_MAX LLONG_MAX
99#define UINT64_MAX ULLONG_MAX
100#define int64_t long long
101#define uint64_t unsigned long long
102
55#endif 103#endif
56 104
57#endif /* __INTTYPES_H__ */ 105#endif /* __INTTYPES_H__ */