diff options
Diffstat (limited to 'src/lib/utils/loadstor.h')
-rw-r--r-- | src/lib/utils/loadstor.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/utils/loadstor.h b/src/lib/utils/loadstor.h index d3871480c..53700fc86 100644 --- a/src/lib/utils/loadstor.h +++ b/src/lib/utils/loadstor.h @@ -11,7 +11,6 @@ #include <botan/types.h> #include <botan/bswap.h> -#include <botan/get_byte.h> #include <botan/mem_ops.h> #include <vector> @@ -40,6 +39,19 @@ namespace Botan { /** +* Byte extraction +* @param byte_num which byte to extract, 0 == highest byte +* @param input the value to extract from +* @return byte byte_num of input +*/ +template<typename T> inline byte get_byte(size_t byte_num, T input) + { + return static_cast<byte>( + input >> ((sizeof(T)-1-(byte_num&(sizeof(T)-1))) << 3) + ); + } + +/** * Make a u16bit from two bytes * @param i0 the first byte * @param i1 the second byte |