diff options
author | lloyd <[email protected]> | 2008-09-28 23:53:01 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 23:53:01 +0000 |
commit | 7853a74932791f7760961ddeb3a6064721eeb8b4 (patch) | |
tree | d5a3cbccc143148af63757cdc78166d85416eb3d /include/bswap.h | |
parent | faadc351369d187b6bb42c6e5a165242a62231da (diff) |
Move util functions into utils/ module
Diffstat (limited to 'include/bswap.h')
-rw-r--r-- | include/bswap.h | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/include/bswap.h b/include/bswap.h deleted file mode 100644 index e38d3c6fa..000000000 --- a/include/bswap.h +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************* -* Byte Swapping Operations Header File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_BSWAP_H__ -#define BOTAN_BSWAP_H__ - -#include <botan/types.h> -#include <botan/rotate.h> - -namespace Botan { - -/************************************************* -* Byte Swapping Functions * -*************************************************/ -inline u16bit reverse_bytes(u16bit input) - { - return rotate_left(input, 8); - } - -inline u32bit reverse_bytes(u32bit input) - { - input = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); - return rotate_left(input, 16); - } - -inline u64bit reverse_bytes(u64bit input) - { - u32bit hi = ((input >> 40) & 0x00FF00FF) | ((input >> 24) & 0xFF00FF00); - u32bit lo = ((input & 0xFF00FF00) >> 8) | ((input & 0x00FF00FF) << 8); - hi = (hi << 16) | (hi >> 16); - lo = (lo << 16) | (lo >> 16); - return (static_cast<u64bit>(lo) << 32) | hi; - } - -} - -#endif |