aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/stubs/mathlimits.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/stubs/mathlimits.h')
-rw-r--r--src/google/protobuf/stubs/mathlimits.h122
1 files changed, 63 insertions, 59 deletions
diff --git a/src/google/protobuf/stubs/mathlimits.h b/src/google/protobuf/stubs/mathlimits.h
index 9c9d0e9a..e603947a 100644
--- a/src/google/protobuf/stubs/mathlimits.h
+++ b/src/google/protobuf/stubs/mathlimits.h
@@ -66,6 +66,8 @@
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/port_def.inc>
+
// ========================================================================= //
// Useful integer and floating point limits and type traits.
@@ -173,43 +175,43 @@ template<typename T> struct MathLimits {
static bool IsPosInf(const Type /*x*/) { return false; } \
static bool IsNegInf(const Type /*x*/) { return false; }
-#define DECL_SIGNED_INT_LIMITS(IntType, UnsignedIntType) \
-template<> \
-struct LIBPROTOBUF_EXPORT MathLimits<IntType> { \
- typedef IntType Type; \
- typedef UnsignedIntType UnsignedType; \
- static const bool kIsSigned = true; \
- static const bool kIsInteger = true; \
- static const Type kPosMin = 1; \
- static const Type kPosMax = SIGNED_INT_MAX(Type); \
- static const Type kMin = SIGNED_INT_MIN(Type); \
- static const Type kMax = kPosMax; \
- static const Type kNegMin = -1; \
- static const Type kNegMax = kMin; \
- static const int kMin10Exp = 0; \
- static const int kMax10Exp = SIGNED_MAX_10_EXP(Type); \
- static const Type kEpsilon = 1; \
- static const Type kStdError = 0; \
- DECL_INT_LIMIT_FUNCS \
-};
+#define DECL_SIGNED_INT_LIMITS(IntType, UnsignedIntType) \
+ template <> \
+ struct PROTOBUF_EXPORT MathLimits<IntType> { \
+ typedef IntType Type; \
+ typedef UnsignedIntType UnsignedType; \
+ static const bool kIsSigned = true; \
+ static const bool kIsInteger = true; \
+ static const Type kPosMin = 1; \
+ static const Type kPosMax = SIGNED_INT_MAX(Type); \
+ static const Type kMin = SIGNED_INT_MIN(Type); \
+ static const Type kMax = kPosMax; \
+ static const Type kNegMin = -1; \
+ static const Type kNegMax = kMin; \
+ static const int kMin10Exp = 0; \
+ static const int kMax10Exp = SIGNED_MAX_10_EXP(Type); \
+ static const Type kEpsilon = 1; \
+ static const Type kStdError = 0; \
+ DECL_INT_LIMIT_FUNCS \
+ };
-#define DECL_UNSIGNED_INT_LIMITS(IntType) \
-template<> \
-struct LIBPROTOBUF_EXPORT MathLimits<IntType> { \
- typedef IntType Type; \
- typedef IntType UnsignedType; \
- static const bool kIsSigned = false; \
- static const bool kIsInteger = true; \
- static const Type kPosMin = 1; \
- static const Type kPosMax = UNSIGNED_INT_MAX(Type); \
- static const Type kMin = 0; \
- static const Type kMax = kPosMax; \
- static const int kMin10Exp = 0; \
- static const int kMax10Exp = UNSIGNED_MAX_10_EXP(Type); \
- static const Type kEpsilon = 1; \
- static const Type kStdError = 0; \
- DECL_INT_LIMIT_FUNCS \
-};
+#define DECL_UNSIGNED_INT_LIMITS(IntType) \
+ template <> \
+ struct PROTOBUF_EXPORT MathLimits<IntType> { \
+ typedef IntType Type; \
+ typedef IntType UnsignedType; \
+ static const bool kIsSigned = false; \
+ static const bool kIsInteger = true; \
+ static const Type kPosMin = 1; \
+ static const Type kPosMax = UNSIGNED_INT_MAX(Type); \
+ static const Type kMin = 0; \
+ static const Type kMax = kPosMax; \
+ static const int kMin10Exp = 0; \
+ static const int kMax10Exp = UNSIGNED_MAX_10_EXP(Type); \
+ static const Type kEpsilon = 1; \
+ static const Type kStdError = 0; \
+ DECL_INT_LIMIT_FUNCS \
+ };
DECL_SIGNED_INT_LIMITS(signed char, unsigned char)
DECL_SIGNED_INT_LIMITS(signed short int, unsigned short int)
@@ -263,29 +265,29 @@ DECL_UNSIGNED_INT_LIMITS(unsigned long long int)
// such constants are not considered to be primitive-type constants by gcc.
// CAVEAT: Hence, they are going to be initialized only during
// the global objects construction time.
-#define DECL_FP_LIMITS(FP_Type, PREFIX) \
-template<> \
-struct LIBPROTOBUF_EXPORT MathLimits<FP_Type> { \
- typedef FP_Type Type; \
- typedef FP_Type UnsignedType; \
- static const bool kIsSigned = true; \
- static const bool kIsInteger = false; \
- static const Type kPosMin; \
- static const Type kPosMax; \
- static const Type kMin; \
- static const Type kMax; \
- static const Type kNegMin; \
- static const Type kNegMax; \
- static const int kMin10Exp = PREFIX##_MIN_10_EXP; \
- static const int kMax10Exp = PREFIX##_MAX_10_EXP; \
- static const Type kEpsilon; \
- static const Type kStdError; \
- static const int kPrecisionDigits = PREFIX##_DIG; \
- static const Type kNaN; \
- static const Type kPosInf; \
- static const Type kNegInf; \
- DECL_FP_LIMIT_FUNCS \
-};
+#define DECL_FP_LIMITS(FP_Type, PREFIX) \
+ template <> \
+ struct PROTOBUF_EXPORT MathLimits<FP_Type> { \
+ typedef FP_Type Type; \
+ typedef FP_Type UnsignedType; \
+ static const bool kIsSigned = true; \
+ static const bool kIsInteger = false; \
+ static const Type kPosMin; \
+ static const Type kPosMax; \
+ static const Type kMin; \
+ static const Type kMax; \
+ static const Type kNegMin; \
+ static const Type kNegMax; \
+ static const int kMin10Exp = PREFIX##_MIN_10_EXP; \
+ static const int kMax10Exp = PREFIX##_MAX_10_EXP; \
+ static const Type kEpsilon; \
+ static const Type kStdError; \
+ static const int kPrecisionDigits = PREFIX##_DIG; \
+ static const Type kNaN; \
+ static const Type kPosInf; \
+ static const Type kNegInf; \
+ DECL_FP_LIMIT_FUNCS \
+ };
DECL_FP_LIMITS(float, FLT)
DECL_FP_LIMITS(double, DBL)
@@ -300,4 +302,6 @@ DECL_FP_LIMITS(long double, LDBL)
} // namespace protobuf
} // namespace google
+#include <google/protobuf/port_undef.inc>
+
#endif // UTIL_MATH_MATHLIMITS_H__