diff options
author | Jack Lloyd <[email protected]> | 2018-03-01 17:04:16 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-01 17:04:16 -0500 |
commit | a5a9ca8d296d0b31de4c03b7dff2b401e6a6ec45 (patch) | |
tree | 32c47aed1908c47843d69719c7f0a11735e09790 | |
parent | 2bea955063e1df520531339a9f7e39531f68a2ca (diff) |
Move declaration of word to types.h
-rw-r--r-- | src/lib/math/bigint/bigint.h | 2 | ||||
-rw-r--r-- | src/lib/math/mp/info.txt | 4 | ||||
-rw-r--r-- | src/lib/math/mp/mp_core.h | 6 | ||||
-rw-r--r-- | src/lib/math/mp/mp_madd.h | 2 | ||||
-rw-r--r-- | src/lib/math/mp/mp_types.h | 33 | ||||
-rw-r--r-- | src/lib/utils/types.h | 12 |
6 files changed, 19 insertions, 40 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 5092187d9..c397a7659 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -9,8 +9,8 @@ #ifndef BOTAN_BIGINT_H_ #define BOTAN_BIGINT_H_ +#include <botan/types.h> #include <botan/secmem.h> -#include <botan/mp_types.h> #include <botan/exceptn.h> #include <botan/loadstor.h> #include <iosfwd> diff --git a/src/lib/math/mp/info.txt b/src/lib/math/mp/info.txt index 0f5b075f0..e93ff79b0 100644 --- a/src/lib/math/mp/info.txt +++ b/src/lib/math/mp/info.txt @@ -2,10 +2,6 @@ BIGINT_MP -> 20151225 </defines> -<header:public> -mp_types.h -</header:public> - <header:internal> mp_core.h mp_madd.h diff --git a/src/lib/math/mp/mp_core.h b/src/lib/math/mp/mp_core.h index f9495c8de..514240197 100644 --- a/src/lib/math/mp/mp_core.h +++ b/src/lib/math/mp/mp_core.h @@ -10,10 +10,14 @@ #ifndef BOTAN_MP_CORE_OPS_H_ #define BOTAN_MP_CORE_OPS_H_ -#include <botan/mp_types.h> +#include <botan/types.h> namespace Botan { +const word MP_WORD_MASK = ~static_cast<word>(0); +const word MP_WORD_TOP_BIT = static_cast<word>(1) << (8*sizeof(word) - 1); +const word MP_WORD_MAX = MP_WORD_MASK; + /* * If cond == 0, does nothing. * If cond > 0, swaps x[0:size] with y[0:size] diff --git a/src/lib/math/mp/mp_madd.h b/src/lib/math/mp/mp_madd.h index 68b9ed644..4807fcd04 100644 --- a/src/lib/math/mp/mp_madd.h +++ b/src/lib/math/mp/mp_madd.h @@ -9,7 +9,7 @@ #ifndef BOTAN_MP_WORD_MULADD_H_ #define BOTAN_MP_WORD_MULADD_H_ -#include <botan/mp_types.h> +#include <botan/types.h> #include <botan/mul128.h> namespace Botan { diff --git a/src/lib/math/mp/mp_types.h b/src/lib/math/mp/mp_types.h deleted file mode 100644 index fb52c2e9a..000000000 --- a/src/lib/math/mp/mp_types.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Low Level MPI Types -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_MPI_TYPES_H_ -#define BOTAN_MPI_TYPES_H_ - -#include <botan/types.h> - -namespace Botan { - -#if (BOTAN_MP_WORD_BITS == 8) - typedef uint8_t word; -#elif (BOTAN_MP_WORD_BITS == 16) - typedef uint16_t word; -#elif (BOTAN_MP_WORD_BITS == 32) - typedef uint32_t word; -#elif (BOTAN_MP_WORD_BITS == 64) - typedef uint64_t word; -#else - #error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64 -#endif - -const word MP_WORD_MASK = ~static_cast<word>(0); -const word MP_WORD_TOP_BIT = static_cast<word>(1) << (8*sizeof(word) - 1); -const word MP_WORD_MAX = MP_WORD_MASK; - -} - -#endif diff --git a/src/lib/utils/types.h b/src/lib/utils/types.h index 953471fb6..10650342b 100644 --- a/src/lib/utils/types.h +++ b/src/lib/utils/types.h @@ -97,6 +97,18 @@ using s32bit = std::int32_t; */ static const size_t DEFAULT_BUFFERSIZE = BOTAN_DEFAULT_BUFFER_SIZE; +#if (BOTAN_MP_WORD_BITS == 8) + typedef uint8_t word; +#elif (BOTAN_MP_WORD_BITS == 16) + typedef uint16_t word; +#elif (BOTAN_MP_WORD_BITS == 32) + typedef uint32_t word; +#elif (BOTAN_MP_WORD_BITS == 64) + typedef uint64_t word; +#else + #error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64 +#endif + } #endif |