diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-07-27 18:14:32 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-07-27 18:14:32 +0000 |
commit | 813505cc1313b7e191b787f93e573acb91fa1464 (patch) | |
tree | 4a6de5a8fb3a54a2e68153ee773d6fd93c93769b /util.h | |
parent | 520f3673196dd6517982e3f662cf62afda368341 (diff) |
added a subset of Crypto++ 5.6.0 with 48% faster ASM SHA-256, combined speedup 2.5x faster vs 0.3.3, thanks BlackEye for figuring out the alignment problem
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@114 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -54,6 +54,20 @@ inline T& REF(const T& val) return (T&)val;
}
+// Align by increasing pointer, must have extra space at end of buffer
+template <size_t nBytes, typename T>
+T* alignup(T* p)
+{
+ union
+ {
+ T* ptr;
+ size_t n;
+ } u;
+ u.ptr = p;
+ u.n = (u.n + (nBytes-1)) & ~(nBytes-1);
+ return u.ptr;
+}
+
#ifdef __WXMSW__
#define MSG_NOSIGNAL 0
#define MSG_DONTWAIT 0
|