📄 crconfig.h
字号:
#ifndef CRCONFIG_H#define CRCONFIG_H// define this if running on a little-endian CPU// SM: I presume the SafeTP macro is defined//#define LITTLE_ENDIAN// define this if you want the library to throw exceptions when things go wrong#define THROW_EXCEPTIONS// define this if your compiler doesn't support namespaces#if defined(__GNUC__) || defined(__BCPLUSPLUS__)#define NO_NAMESPACE#endif// define this if your compiler only has the old version of iostream library#ifdef __GNUC__#define OLD_IOSTREAM#endif// switch between different secure memory allocation mechnisms, this is the only// one available right now#define SECALLOC_DEFAULT// Define this to 0 if your system doesn't differentiate between// text mode and binary mode files.// #define BINARY_MODE 0#define BINARY_MODE ios::binary// #define BINARY_MODE ios::bin// Define this to 0 if your compiler doesn't have ios::nocreate.// This is needed because some compilers automaticly create a new file// when you try to open one for reading if it doesn't already exist.#define FILE_NO_CREATE 0// #define FILE_NO_CREATE ios::nocreate// define this if you have a copy of RSAREF and want to compile the RSAREF// class wrappers// #define USE_RSAREF// define this if you want to be able to initialize RSAREF structures with bignums// #define USE_BIGNUM_WITH_RSAREF#define GZIP_OS_CODE 0// how much memory to use for deflation (compression)// note 16 bit compilers don't work with BIG_MEM (pointer wraps around segment boundary)// #define SMALL_MEM#define MEDIUM_MEM// #define BIG_MEM// Define the following to use the updated standard SHA-1 instead of SHA#define NEW_SHA// Try this if your CPU has 256K internal cache or a slow multiply instruction// and you want a (possibly) faster IDEA implementation using log tables// #define IDEA_LARGECACHE// Try this if you have a large cache or your CPU is slow manipulating// individual bytes.// #define DIAMOND_USE_PERMTABLE// Define this if, for the linear congruential RNG, you want to use// the original constants as specified in S.K. Park and K.W. Miller's// CACM paper.// #define LCRNG_ORIGINAL_NUMBERS// Make sure these typedefs are correct for your computertypedef unsigned char byte;typedef unsigned short word16;#if defined(__alpha) && !defined(_MSC_VER)typedef unsigned int word32;#elsetypedef unsigned long word32;#endif#ifdef __GNUC__#define WORD64_AVAILABLEtypedef unsigned long long word64;#define W64LIT(x) x##LL#endif#ifdef _MSC_VER#define WORD64_AVAILABLEtypedef unsigned __int64 word64;#define W64LIT(x) x##i64#endif// word should have the same size as your CPU registers// dword should be twice as big as word#ifndef SAFETP# if defined(__GNUC__) && !defined(__alpha) typedef unsigned long word; typedef unsigned long long dword;# elif defined(_MSC_VER) typedef unsigned __int32 word; typedef unsigned __int64 dword;# else typedef unsigned int word; typedef unsigned long dword;# endif#else// it's been very difficult trying to isolate problems when// builds on different machines use different word sizes,// so I'm switching to always use 16-bit words#undef WORD64_AVAILABLE// SM: this is the right way to do it, assuming that word16, word32// and word64 are declared as above# ifdef WORD64_AVAILABLE typedef word32 word; typedef word64 dword;# else typedef word16 word; typedef word32 dword;# endif// borland allows these checks at compile-time# ifdef __BORLANDC__# if sizeof(word)*2 != sizeof(dword)# error word and dword do not have the right size relationship# endif# endif#endifconst unsigned int WORD_SIZE = sizeof(word);const unsigned int WORD_BITS = WORD_SIZE * 8;#define LOW_WORD(x) (word)(x)#ifdef SAFETP_LITTLE_ENDIAN #define HIGH_WORD(x) (*(((word *)&(x))+1))#else #define HIGH_WORD(x) (*((word *)&(x)))#endif// if the above HIGH_WORD macro doesn't work (if you are not sure, compile it// and run the validation tests), try this:// #define HIGH_WORD(x) (word)((x)>>WORD_BITS)#ifdef _MSC_VER// 4250: dominance// 4660: explicitly instantiating a class that's already implicitly instantiated#pragma warning(disable: 4250 4660)#endif#ifdef NO_NAMESPACE// defining 'std' to nothing breaks gcc-3's headers//# define std# define USING_NAMESPACE(x)# define NAMESPACE_BEGIN(x)# define NAMESPACE_END# define ANONYMOUS_NAMESPACE_BEGIN#else# define USING_NAMESPACE(x) using namespace x;# define NAMESPACE_BEGIN(x) namespace x {# define ANONYMOUS_NAMESPACE_BEGIN namespace {# define NAMESPACE_END }#endif#ifdef _MSC_VER// VC50 workaround#define STDMIN std::_cpp_min#define STDMAX std::_cpp_max#else#define STDMIN std::min#define STDMAX std::max#endif// SM: my additions -------------------------#ifdef SAFETP# define explicit // not supported# undef STDMIN // suppress warning about redefinition# undef STDMAX# define STDMIN mymin# define STDMAX mymax# include "typ.h" // bool, mymin, mymax# define OLD_IOSTREAM // for iosfwd.h#ifdef __EDGCPFE# define INSTANTIATE_TEMPLATE template#else // g++ or borland# define INSTANTIATE_TEMPLATE /*template*/#endif#else // !SAFETP --------# define STDSWAP std::swap# define INSTANTIATE_TEMPLATE template#endif // !SAFETP --------#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -