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 | |
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')
-rw-r--r-- | src/utils/cpuid.cpp | 2 | ||||
-rw-r--r-- | src/utils/get_byte.h | 27 | ||||
-rw-r--r-- | src/utils/info.txt | 1 | ||||
-rw-r--r-- | src/utils/loadstor.h | 11 | ||||
-rw-r--r-- | src/utils/parsing.cpp | 2 |
5 files changed, 31 insertions, 12 deletions
diff --git a/src/utils/cpuid.cpp b/src/utils/cpuid.cpp index 924d29b1b..8d801b75f 100644 --- a/src/utils/cpuid.cpp +++ b/src/utils/cpuid.cpp @@ -7,7 +7,7 @@ #include <botan/cpuid.h> #include <botan/types.h> -#include <botan/loadstor.h> +#include <botan/get_byte.h> #include <botan/mem_ops.h> #if defined(BOTAN_TARGET_OS_IS_DARWIN) 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 diff --git a/src/utils/info.txt b/src/utils/info.txt index 193d63a87..2fb3e79a5 100644 --- a/src/utils/info.txt +++ b/src/utils/info.txt @@ -35,6 +35,7 @@ time.h types.h ui.h version.h +get_byte.h </header:public> <libs> diff --git a/src/utils/loadstor.h b/src/utils/loadstor.h index bd2acc87d..ffd27540d 100644 --- a/src/utils/loadstor.h +++ b/src/utils/loadstor.h @@ -11,6 +11,7 @@ #include <botan/types.h> #include <botan/bswap.h> +#include <botan/get_byte.h> #include <cstring> #if BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK @@ -38,16 +39,6 @@ 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) - ); - } - -/* * Byte to Word Conversions */ inline u16bit make_u16bit(byte i0, byte i1) diff --git a/src/utils/parsing.cpp b/src/utils/parsing.cpp index 4b99ac1ec..e8259ac52 100644 --- a/src/utils/parsing.cpp +++ b/src/utils/parsing.cpp @@ -8,7 +8,7 @@ #include <botan/parsing.h> #include <botan/exceptn.h> #include <botan/charset.h> -#include <botan/loadstor.h> +#include <botan/get_byte.h> namespace Botan { |