aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/rotate.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-28 23:59:53 +0000
committerlloyd <[email protected]>2008-09-28 23:59:53 +0000
commit45c4fcfce66d894dda6b1d29a92fa47515b944af (patch)
tree75b96e2003588308e098d8b4a8dfcc4f89df9780 /src/utils/rotate.h
parentc14cca7ef7338de3a8da784dd0865634b4110539 (diff)
More headers (loadstore, mem_ops, rotate, types) for util module
Diffstat (limited to 'src/utils/rotate.h')
-rw-r--r--src/utils/rotate.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/utils/rotate.h b/src/utils/rotate.h
new file mode 100644
index 000000000..d90e207b5
--- /dev/null
+++ b/src/utils/rotate.h
@@ -0,0 +1,28 @@
+/*************************************************
+* Word Rotation Operations Header File *
+* (C) 1999-2008 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_WORD_ROTATE_H__
+#define BOTAN_WORD_ROTATE_H__
+
+#include <botan/types.h>
+
+namespace Botan {
+
+/*************************************************
+* Word Rotation Functions *
+*************************************************/
+template<typename T> inline T rotate_left(T input, u32bit rot)
+ {
+ return static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));;
+ }
+
+template<typename T> inline T rotate_right(T input, u32bit rot)
+ {
+ return static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot)));
+ }
+
+}
+
+#endif