mirror of https://github.com/zeldaret/tp.git
70 lines
1.4 KiB
Plaintext
70 lines
1.4 KiB
Plaintext
#ifndef _STD_LIMITS_H
|
|
#define _STD_LIMITS_H
|
|
|
|
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 |