diff options
author | --author=Satoshi Nakamoto <satoshin@gmx.com> | 2010-07-27 20:43:55 +0000 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2010-07-27 20:43:55 +0000 |
commit | 3dd20ff2f87958a440c9dceae8abe3967aa48fcf (patch) | |
tree | 5cf88b4e9ba89460a83488561d9fd23feaa87365 /util.h | |
parent | 9f35575ca34eb15b20d1d5374b56ac9d4c8cc2bf (diff) | |
download | bitcoin-3dd20ff2f87958a440c9dceae8abe3967aa48fcf.tar.xz |
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
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 |