summaryrefslogtreecommitdiff
path: root/integer.h
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2007-04-15 23:00:27 +0000
committerweidai <weidai11@users.noreply.github.com>2007-04-15 23:00:27 +0000
commit643b3022278591c8a784f5a34f689548a4ad62b1 (patch)
tree6d117430c0ea76a7444fa3871d1898995d825ada /integer.h
parent3b89824be3a8d3974ad0316f2067451c3072bffc (diff)
downloadcryptopp-git-643b3022278591c8a784f5a34f689548a4ad62b1.tar.gz
MMX/SSE2 optimizations
Diffstat (limited to 'integer.h')
-rw-r--r--integer.h37
1 files changed, 3 insertions, 34 deletions
diff --git a/integer.h b/integer.h
index 547e3778..4e93c3a1 100644
--- a/integer.h
+++ b/integer.h
@@ -11,44 +11,13 @@
NAMESPACE_BEGIN(CryptoPP)
-#if defined(SSE2_INTRINSICS_AVAILABLE)
- template <class T>
- class AlignedAllocator : public AllocatorBase<T>
- {
- public:
- CRYPTOPP_INHERIT_ALLOCATOR_TYPES
-
- pointer allocate(size_type n, const void *);
- void deallocate(void *p, size_type n);
- pointer reallocate(T *p, size_type oldSize, size_type newSize, bool preserve)
- {
- return StandardReallocate(*this, p, oldSize, newSize, preserve);
- }
-
- #if !(defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16) || defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE))
- #define CRYPTOPP_NO_ALIGNED_ALLOC
- AlignedAllocator() : m_pBlock(NULL) {}
- protected:
- void *m_pBlock;
- #endif
- };
-
- #ifdef CRYPTOPP_IMPORTS
- CRYPTOPP_DLL_TEMPLATE_CLASS AlignedAllocator<word>;
- #endif
-
- typedef SecBlock<word, AlignedAllocator<word> > SecAlignedWordBlock;
-#else
- typedef SecWordBlock SecAlignedWordBlock;
-#endif
-
-void CRYPTOPP_DLL CRYPTOPP_API DisableSSE2();
-
struct InitializeInteger // used to initialize static variables
{
InitializeInteger();
};
+typedef SecBlock<word, AllocatorWithCleanup<word, CRYPTOPP_BOOL_X86> > IntegerSecBlock;
+
//! multiple precision integer and basic arithmetics
/*! This class can represent positive and negative integers
with absolute value less than (256**sizeof(word)) ** (256**sizeof(int)).
@@ -406,7 +375,7 @@ private:
friend void PositiveMultiply(Integer &product, const Integer &a, const Integer &b);
friend void PositiveDivide(Integer &remainder, Integer &quotient, const Integer &dividend, const Integer &divisor);
- SecAlignedWordBlock reg;
+ IntegerSecBlock reg;
Sign sign;
};