From e1ae1d68309573134fc1242c3bfb8a8ce0672737 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 19 Sep 2015 07:43:45 -0400 Subject: Internal header cleanups Only user-visible change is the removal of get_byte.h --- src/lib/utils/loadstor.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lib/utils/loadstor.h') 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 #include -#include #include #include @@ -39,6 +38,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 inline byte get_byte(size_t byte_num, T input) + { + return static_cast( + input >> ((sizeof(T)-1-(byte_num&(sizeof(T)-1))) << 3) + ); + } + /** * Make a u16bit from two bytes * @param i0 the first byte -- cgit v1.2.3