diff options
author | weidai <weidai11@users.noreply.github.com> | 2007-04-15 23:00:27 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2007-04-15 23:00:27 +0000 |
commit | 643b3022278591c8a784f5a34f689548a4ad62b1 (patch) | |
tree | 6d117430c0ea76a7444fa3871d1898995d825ada /integer.h | |
parent | 3b89824be3a8d3974ad0316f2067451c3072bffc (diff) | |
download | cryptopp-git-643b3022278591c8a784f5a34f689548a4ad62b1.tar.gz |
MMX/SSE2 optimizations
Diffstat (limited to 'integer.h')
-rw-r--r-- | integer.h | 37 |
1 files changed, 3 insertions, 34 deletions
@@ -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 "ient, const Integer ÷nd, const Integer &divisor); - SecAlignedWordBlock reg; + IntegerSecBlock reg; Sign sign; }; |