diff options
author | lloyd <[email protected]> | 2010-02-02 10:49:43 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-02 10:49:43 +0000 |
commit | 7667619fa001b4b9dd9df663fc01fa7c31e5f4f9 (patch) | |
tree | d5e20f6b94478df76893755adb54c66ae6276abf /src/utils/get_byte.h | |
parent | cf3e984dbffc0fb2a695306a9b4d53257bb74ea8 (diff) |
Move the get_byte template to its own header, because many files
including loadstor.h actually just needed get_byte and nothing else.
Diffstat (limited to 'src/utils/get_byte.h')
-rw-r--r-- | src/utils/get_byte.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/get_byte.h b/src/utils/get_byte.h new file mode 100644 index 000000000..fce87af83 --- /dev/null +++ b/src/utils/get_byte.h @@ -0,0 +1,27 @@ +/* +* Read out bytes +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_GET_BYTE_H__ +#define BOTAN_GET_BYTE_H__ + +#include <botan/types.h> + +namespace Botan { + +/* +* Byte Extraction Function +*/ +template<typename T> inline byte get_byte(u32bit byte_num, T input) + { + return static_cast<byte>( + input >> ((sizeof(T)-1-(byte_num&(sizeof(T)-1))) << 3) + ); + } + +} + +#endif |