From 3dd20ff2f87958a440c9dceae8abe3967aa48fcf Mon Sep 17 00:00:00 2001 From: --author=Satoshi Nakamoto Date: Tue, 27 Jul 2010 20:43:55 +0000 Subject: 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 --- util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index d05ab695cd..1981ec95e9 100644 --- a/util.h +++ b/util.h @@ -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 +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 -- cgit v1.2.3