summaryrefslogtreecommitdiff
path: root/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h
blob: 55110c724c41c5f5a4f163fab331bb2a5fe95f13 (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
#ifndef _STD_LIMITS_H
#define _STD_LIMITS_H

#ifdef __cplusplus
extern "C" {
#endif

#define CHAR_BIT 8

#define SCHAR_MIN (-0x7F - 1)
#define SCHAR_MAX 0x7F
#define UCHAR_MAX 0xFF

#define CHAR_MIN 0
#define CHAR_MAX SCHAR_MAX

#define SHRT_MIN  (-0x7FFF - 1)
#define SHRT_MAX  0x7FFF
#define USHRT_MAX 0xFFFF

#define INT_MIN  (-0x7FFFFFFF - 1)
#define INT_MAX  0x7FFFFFFF
#define UINT_MAX 0xFFFFFFFF

#define LONG_MIN  (-0x7FFFFFFFL - 1)
#define LONG_MAX  0x7FFFFFFFL
#define ULONG_MAX 0xFFFFFFFFUL

#define LLONG_MIN  (-0x7FFFFFFFFFFFFFFFLL - 1)
#define LLONG_MAX  0x7FFFFFFFFFFFFFFFLL
#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL

#ifdef __cplusplus
}

namespace std {
template <typename T>
class numeric_limits {
public:
	inline static T min();
	inline static T max();
};

template <>
class numeric_limits<char> {
public:
	inline static char min() { return -0x80; }
	inline static char max() { return 0x7F; }
};

template <>
class numeric_limits<short> {
public:
	inline static short min() { return -0x8000; }
	inline static short max() { return 0x7FFF; }
};

template <>
class numeric_limits<int> {
public:
	inline static int min() { return -0x80000000; }
	inline static int max() { return 0x7FFFFFFF; }
};

template <>
class numeric_limits<long> {
public:
	inline static long min() { return -0x80000000; }
	inline static long max() { return 0x7FFFFFFF; }
};

template <>
class numeric_limits<unsigned char> {
public:
	inline static unsigned char min() { return 0x0; }
	inline static unsigned char max() { return 0xFF; }
};

template <>
class numeric_limits<unsigned short> {
public:
	inline static unsigned short min() { return 0x0; }
	inline static unsigned short max() { return 0xFFFF; }
};

template <>
class numeric_limits<unsigned int> {
public:
	inline static unsigned int min() { return 0x0; }
	inline static unsigned int max() { return 0xFFFFFFFF; }
};

template <>
class numeric_limits<unsigned long> {
public:
	inline static unsigned long min() { return 0x0; }
	inline static unsigned long max() { return 0xFFFFFFFF; }
};

} // namespace std
#endif
#endif