summaryrefslogtreecommitdiff
path: root/cipher/bithelp.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-06-14 13:58:18 +0200
committerWerner Koch <wk@gnupg.org>2017-06-14 13:58:18 +0200
commit6c882fb1fdb6c7cba2215fa7391110d63e24b9dc (patch)
tree491cfab87813fee6fe3ac6e99df6b0d41985df56 /cipher/bithelp.h
parent06f303a633ea2b992259688bef2b023c3f388f73 (diff)
downloadlibgcrypt-6c882fb1fdb6c7cba2215fa7391110d63e24b9dc.tar.gz
cipher: New helper function rol64.
* cipher/bithelp.h (rol64): New inline functions. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/bithelp.h')
-rw-r--r--cipher/bithelp.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/cipher/bithelp.h b/cipher/bithelp.h
index 45753805..26ef7c35 100644
--- a/cipher/bithelp.h
+++ b/cipher/bithelp.h
@@ -35,6 +35,11 @@ static inline u32 ror(u32 x, int n)
return ( (x >> (n&(32-1))) | (x << ((32-n)&(32-1))) );
}
+static inline u64 rol64(u64 x, int n)
+{
+ return ( (x << (n&(64-1))) | (x >> ((64-n)&(64-1))) );
+}
+
/* Byte swap for 32-bit and 64-bit integers. If available, use compiler
provided helpers. */
#ifdef HAVE_BUILTIN_BSWAP32