From e5085684efe71cb48ccb4385f40cd3cc62d5f66c Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 1 Jan 2019 17:56:26 -0500 Subject: [PATCH] Fix missing SunCC Allocator::max_size(size_type) member function (GH #770) --- aria_simd.cpp | 2 +- secblock.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/aria_simd.cpp b/aria_simd.cpp index 536cfb84..6222439b 100644 --- a/aria_simd.cpp +++ b/aria_simd.cpp @@ -47,7 +47,7 @@ using CryptoPP::byte; using CryptoPP::word32; inline byte ARIA_BRF(const word32 x, const int y) { - return GETBYTE(x, y); + return static_cast(GETBYTE(x, y)); } ANONYMOUS_NAMESPACE_END diff --git a/secblock.h b/secblock.h index 26ebd0ae..ba70b487 100644 --- a/secblock.h +++ b/secblock.h @@ -71,6 +71,12 @@ public: /// to optimize it well in either form. CRYPTOPP_CONSTEXPR size_type max_size() const {return ELEMS_MAX;} +#if defined(__SUNPRO_CC) + // https://github.com/weidai11/cryptopp/issues/770 + // and https://stackoverflow.com/q/53999461/608639 + CRYPTOPP_CONSTEXPR size_type max_size(size_type n) const {return (~(size_type)0)/n;} +#endif + #if defined(CRYPTOPP_CXX11_VARIADIC_TEMPLATES) || defined(CRYPTOPP_DOXYGEN_PROCESSING) /// \brief Constructs a new V using variadic arguments