Make NumericLimitsMin and NumericLimitsMax available to MSVC (Issue 364)

This commit is contained in:
Jeffrey Walton 2017-01-15 19:36:36 -05:00
parent b274f06202
commit 1d391c190d
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

7
misc.h
View File

@ -116,8 +116,8 @@
#endif // CRYPTOPP_DOXYGEN_PROCESSING #endif // CRYPTOPP_DOXYGEN_PROCESSING
// http://github.com/weidai11/cryptopp/issues/364 // NumericLimitsMin and NumericLimitsMax added for word128 types,
#if defined(CRYPTOPP_WORD128_AVAILABLE) // see http://github.com/weidai11/cryptopp/issues/364
ANONYMOUS_NAMESPACE_BEGIN ANONYMOUS_NAMESPACE_BEGIN
template<class T> template<class T>
T NumericLimitsMin() T NumericLimitsMin()
@ -131,6 +131,7 @@ T NumericLimitsMax()
CRYPTOPP_ASSERT(std::numeric_limits<T>::is_specialized); CRYPTOPP_ASSERT(std::numeric_limits<T>::is_specialized);
return std::numeric_limits<T>::max(); return std::numeric_limits<T>::max();
}; };
#if defined(CRYPTOPP_WORD128_AVAILABLE)
template<> template<>
CryptoPP::word128 NumericLimitsMin() CryptoPP::word128 NumericLimitsMin()
{ {
@ -141,8 +142,8 @@ CryptoPP::word128 NumericLimitsMax()
{ {
return (((CryptoPP::word128)W64LIT(0xffffffffffffffff)) << 64U) | (CryptoPP::word128)W64LIT(0xffffffffffffffff); return (((CryptoPP::word128)W64LIT(0xffffffffffffffff)) << 64U) | (CryptoPP::word128)W64LIT(0xffffffffffffffff);
} }
ANONYMOUS_NAMESPACE_END
#endif #endif
ANONYMOUS_NAMESPACE_END
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)