diff options
author | Jack Lloyd <[email protected]> | 2015-09-19 07:43:45 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-09-19 07:43:45 -0400 |
commit | e1ae1d68309573134fc1242c3bfb8a8ce0672737 (patch) | |
tree | d4cbfc7b2c1f70d06fa57403f533be5e434c869f /src/lib/utils/loadstor.h | |
parent | e2e0f8f2b595122c1f8acb3b3a46501f96a2b218 (diff) |
Internal header cleanups
Only user-visible change is the removal of get_byte.h
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 |