summaryrefslogtreecommitdiff
path: root/integer.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-06-09 06:28:22 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-06-09 06:28:22 +0000
commitd20fa8832f0aeb94dfa627a846df1a641fa46f64 (patch)
treeae7f4e2f59555b8957c8e55e10c4caa87d5979d2 /integer.cpp
parentc135471f8a27226c2408d8a8402b1f85af650777 (diff)
downloadcryptopp-d20fa8832f0aeb94dfa627a846df1a641fa46f64.tar.gz
improve Integer initialization
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@222 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'integer.cpp')
-rw-r--r--integer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/integer.cpp b/integer.cpp
index 8a7767e..cc3dfa5 100644
--- a/integer.cpp
+++ b/integer.cpp
@@ -50,8 +50,6 @@ bool AssignIntToInteger(const std::type_info &valueType, void *pInteger, const v
return true;
}
-static const char s_RunAtStartup = (g_pAssignIntToInteger = AssignIntToInteger, 0);
-
#ifdef SSE2_INTRINSICS_AVAILABLE
template <class T>
CPP_TYPENAME AllocatorBase<T>::pointer AlignedAllocator<T>::allocate(size_type n, const void *)
@@ -1047,8 +1045,6 @@ static void SetPentiumFunctionPointers()
#endif
}
-static const char s_RunAtStartupSetPentiumFunctionPointers = (SetPentiumFunctionPointers(), 0);
-
void DisableSSE2()
{
s_sse2Enabled = false;
@@ -2726,6 +2722,17 @@ void MultiplyByPower2Mod(word *R, const word *A, size_t k, const word *M, size_t
// ******************************************************************
+InitializeInteger::InitializeInteger()
+{
+ if (!g_pAssignIntToInteger)
+ {
+#ifdef CRYPTOPP_X86ASM_AVAILABLE
+ SetPentiumFunctionPointers();
+#endif
+ g_pAssignIntToInteger = AssignIntToInteger;
+ }
+}
+
static const unsigned int RoundupSizeTable[] = {2, 2, 2, 4, 4, 8, 8, 8, 8};
static inline size_t RoundupSize(size_t n)