diff options
author | lloyd <[email protected]> | 2008-09-28 23:59:53 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 23:59:53 +0000 |
commit | 45c4fcfce66d894dda6b1d29a92fa47515b944af (patch) | |
tree | 75b96e2003588308e098d8b4a8dfcc4f89df9780 /src/utils/rotate.h | |
parent | c14cca7ef7338de3a8da784dd0865634b4110539 (diff) |
More headers (loadstore, mem_ops, rotate, types) for util module
Diffstat (limited to 'src/utils/rotate.h')
-rw-r--r-- | src/utils/rotate.h | 28 |
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 |