diff options
Diffstat (limited to 'dep/acelite/ace/Numeric_Limits.h')
-rw-r--r-- | dep/acelite/ace/Numeric_Limits.h | 104 |
1 files changed, 43 insertions, 61 deletions
diff --git a/dep/acelite/ace/Numeric_Limits.h b/dep/acelite/ace/Numeric_Limits.h index 0a1d5f2e8c3..c8ab7c2ff7b 100644 --- a/dep/acelite/ace/Numeric_Limits.h +++ b/dep/acelite/ace/Numeric_Limits.h @@ -4,7 +4,7 @@ /** * @file Numeric_Limits.h * - * $Id: Numeric_Limits.h 85057 2009-04-08 10:59:58Z msmit $ + * $Id: Numeric_Limits.h 95761 2012-05-15 18:23:04Z johnnyw $ * * Traits containing basic integer limits. Useful for template-based * code on platforms that lack @c std::numeric_limits<>. @@ -44,7 +44,7 @@ // // Ideally, we could prevent those macros from being defined by // defining the Windows-specific NOMINMAX symbol before any Windows -// headers are included, preferrably on the command line. However, +// headers are included, preferably on the command line. However, // that would probably break some applications. // // @@ Why isn't this a problem with MSVC++ and Borland builds? @@ -52,11 +52,6 @@ # undef max # endif /* __MINGW32__ */ -# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -// For ACE_U_LongLong. -# include "ace/Basic_Types.h" -# endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ - # include <limits> #endif /* ACE_LACKS_NUMERIC_LIMITS */ @@ -112,34 +107,32 @@ struct ACE_Export ACE_Numeric_Limits<signed long> static signed long max (void) { return LONG_MAX; } }; -// #ifndef ACE_LACKS_LONGLONG_T -// template<> -// struct ACE_Export ACE_Numeric_Limits<signed long long> -// { -// #if defined (LLONG_MIN) -// # define ACE_LLONG_MIN LLONG_MIN -// #elif defined (LONG_LONG_MIN) -// # define ACE_LLONG_MIN LONG_LONG_MIN -// #elif defined (LONGLONG_MIN) -// # define ACE_LLONG_MIN LONGLONG_MIN -// #else -// # error Unable to determine minimum signed long long value. -// #endif /* LLONG_MIN */ - -// #if defined (LLONG_MAX) -// # define ACE_LLONG_MAX LLONG_MAX -// #elif defined (LONG_LONG_MAX) -// # define ACE_LLONG_MAX LONG_LONG_MAX -// #elif defined (LONGLONG_MAX) -// # define ACE_LLONG_MAX LONGLONG_MAX -// #else -// # error Unable to determine maximum signed long long value. -// #endif /* LLONG_MAX */ - -// static signed long long min (void) { return ACE_LLONG_MIN; } -// static signed long long max (void) { return ACE_LLONG_MAX; } -// }; -// #endif /* !ACE_LACKS_LONGLONG_T */ +template<> +struct ACE_Export ACE_Numeric_Limits<signed long long> +{ +#if defined (LLONG_MIN) +# define ACE_LLONG_MIN LLONG_MIN +#elif defined (LONG_LONG_MIN) +# define ACE_LLONG_MIN LONG_LONG_MIN +#elif defined (LONGLONG_MIN) +# define ACE_LLONG_MIN LONGLONG_MIN +#else +# error Unable to determine minimum signed long long value. +#endif /* LLONG_MIN */ + +#if defined (LLONG_MAX) +# define ACE_LLONG_MAX LLONG_MAX +#elif defined (LONG_LONG_MAX) +# define ACE_LLONG_MAX LONG_LONG_MAX +#elif defined (LONGLONG_MAX) +# define ACE_LLONG_MAX LONGLONG_MAX +#else +# error Unable to determine maximum signed long long value. +#endif /* LLONG_MAX */ + + static signed long long min (void) { return ACE_LLONG_MIN; } + static signed long long max (void) { return ACE_LLONG_MAX; } +}; // ------------------------------------------ // Unsigned integers @@ -171,23 +164,21 @@ struct ACE_Export ACE_Numeric_Limits<unsigned long> static unsigned long max (void) { return ULONG_MAX; } }; -// #ifndef ACE_LACKS_LONGLONG_T -// template<> -// struct ACE_Export ACE_Numeric_Limits<unsigned long long> -// { -// static unsigned long long min (void) { return 0; } -// static unsigned long long max (void) -// { -// # if defined (ULLONG_MAX) -// return ULLONG_MAX; -// # elif defined (ULONGLONG_MAX) -// return ULONGLONG_MAX; -// # else -// # error Unable to determine maximum unsigned long long value. -// # endif /* ULLONG_MAX */ -// } -// }; -// #endif /* !ACE_LACKS_LONGLONG_T */ +template<> +struct ACE_Export ACE_Numeric_Limits<unsigned long long> +{ + static unsigned long long min (void) { return 0; } + static unsigned long long max (void) + { +# if defined (ULLONG_MAX) + return ULLONG_MAX; +# elif defined (ULONGLONG_MAX) + return ULONGLONG_MAX; +# else +# error Unable to determine maximum unsigned long long value. +# endif /* ULLONG_MAX */ + } +}; // ------------------------------------------ // Floating point types @@ -254,15 +245,6 @@ struct ACE_Numeric_Limits<ULONGLONG> #endif /* ACE_LACKS_NUMERIC_LIMITS */ -#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -template<> -struct ACE_Numeric_Limits<ACE_U_LongLong> -{ - static ACE_U_LongLong min (void) { return ACE_U_LongLong (); /* 0 */ } - static ACE_U_LongLong max (void) { return ACE_UINT64_MAX; } -}; -#endif /* ACE_LACKS_LONGLONG_T || defined ACE_LACKS_UNSIGNEDLONGLONG_T */ - ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" |