Botan
1.11.15
|
00001 /* 00002 * Low Level MPI Types 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_MPI_TYPES_H__ 00009 #define BOTAN_MPI_TYPES_H__ 00010 00011 #include <botan/types.h> 00012 #include <botan/mul128.h> 00013 00014 namespace Botan { 00015 00016 #if (BOTAN_MP_WORD_BITS == 8) 00017 typedef byte word; 00018 typedef u16bit dword; 00019 #define BOTAN_HAS_MP_DWORD 00020 #elif (BOTAN_MP_WORD_BITS == 16) 00021 typedef u16bit word; 00022 typedef u32bit dword; 00023 #define BOTAN_HAS_MP_DWORD 00024 #elif (BOTAN_MP_WORD_BITS == 32) 00025 typedef u32bit word; 00026 typedef u64bit dword; 00027 #define BOTAN_HAS_MP_DWORD 00028 #elif (BOTAN_MP_WORD_BITS == 64) 00029 typedef u64bit word; 00030 00031 #if defined(BOTAN_TARGET_HAS_NATIVE_UINT128) 00032 typedef uint128_t dword; 00033 #define BOTAN_HAS_MP_DWORD 00034 #endif 00035 00036 #else 00037 #error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64 00038 #endif 00039 00040 const word MP_WORD_MASK = ~static_cast<word>(0); 00041 const word MP_WORD_TOP_BIT = static_cast<word>(1) << (8*sizeof(word) - 1); 00042 const word MP_WORD_MAX = MP_WORD_MASK; 00043 00044 } 00045 00046 #endif