diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2008-12-22 06:55:08 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2008-12-22 06:55:08 +0000 |
commit | 83c4add7725ca2489ee5f10aee215e804368838b (patch) | |
tree | fb71bcd9079c3d52aa10d6a7c41a2f97412c6033 | |
parent | fca600f5f0c5759de6fe2f671aae8b183706c4b0 (diff) | |
download | cryptopp-83c4add7725ca2489ee5f10aee215e804368838b.tar.gz |
fix compile with GCC 4.0.1 on MacOS X 64-bit
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@430 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r-- | config.h | 11 | ||||
-rw-r--r-- | integer.cpp | 2 | ||||
-rw-r--r-- | iterhash.cpp | 12 | ||||
-rw-r--r-- | iterhash.h | 14 |
4 files changed, 27 insertions, 12 deletions
@@ -123,6 +123,10 @@ typedef unsigned int word32; const lword LWORD_MAX = 0xffffffffUL; #endif +#ifdef __GNUC__ + #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif + // define hword, word, and dword. these are used for multiprecision integer arithmetic // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx #if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) @@ -131,7 +135,8 @@ typedef unsigned int word32; #else #define CRYPTOPP_NATIVE_DWORD_AVAILABLE #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__) - #if defined(__GNUC__) && !defined(__INTEL_COMPILER) + #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) + // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3 typedef word32 hword; typedef word64 word; typedef __uint128_t dword; @@ -181,10 +186,6 @@ NAMESPACE_END #endif #endif -#ifdef __GNUC__ - #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) -#endif - #ifndef CRYPTOPP_ALIGN_DATA #if defined(CRYPTOPP_MSVC6PP_OR_LATER) #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) diff --git a/integer.cpp b/integer.cpp index e5aa95e..0926a0b 100644 --- a/integer.cpp +++ b/integer.cpp @@ -101,7 +101,7 @@ static word AtomicInverseModPower2(word A) // ******************************************************** -#if !defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE) || defined(__x86_64__) +#if !defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE) || (defined(__x86_64__) && defined(CRYPTOPP_WORD128_AVAILABLE)) #define Declare2Words(x) word x##0, x##1; #define AssignWord(a, b) a##0 = b; a##1 = 0; #define Add2WordsBy1(a, b, c) a##0 = b##0 + c; a##1 = b##1 + (a##0 < c); diff --git a/iterhash.cpp b/iterhash.cpp index 273e034..44360b1 100644 --- a/iterhash.cpp +++ b/iterhash.cpp @@ -1,6 +1,8 @@ // iterhash.cpp - written and placed in the public domain by Wei Dai +#ifndef __GNUC__ #define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES +#endif #include "iterhash.h" #include "misc.h" @@ -142,4 +144,14 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::TruncatedFinal(by this->Restart(); // reinit for next use } +#ifdef __GNUC__ + #ifdef WORD64_AVAILABLE + template class IteratedHashBase<word64, HashTransformation>; + template class IteratedHashBase<word64, MessageAuthenticationCode>; + #endif + + template class IteratedHashBase<word32, HashTransformation>; + template class IteratedHashBase<word32, MessageAuthenticationCode>; +#endif + NAMESPACE_END @@ -93,14 +93,16 @@ protected: FixedSizeSecBlock<T_HashWordType, T_BlockSize/sizeof(T_HashWordType)> m_state; }; -#ifdef WORD64_AVAILABLE -CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word64, HashTransformation>; -CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCode>; +#ifndef __GNUC__ + #ifdef WORD64_AVAILABLE + CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word64, HashTransformation>; + CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCode>; + #endif + + CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>; + CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>; #endif -CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>; -CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>; - NAMESPACE_END #endif |