diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-05-04 15:24:09 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-05-04 15:24:09 +0000 |
commit | df1ffe1e41f89222c379d982e543c2a32da78cbd (patch) | |
tree | 3ddcd92ac078642dfed5375980dc2db4006d1498 /cpu.h | |
parent | 1bb93ea95e3131c2b9a4f8f8bd3f3197e4d52a76 (diff) | |
download | cryptopp-df1ffe1e41f89222c379d982e543c2a32da78cbd.tar.gz |
fix compile for x64, DLL and VC 6
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@332 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'cpu.h')
-rwxr-xr-x | cpu.h | 33 |
1 files changed, 28 insertions, 5 deletions
@@ -3,6 +3,10 @@ #include "config.h" +#ifdef CRYPTOPP_MSVC6PP_OR_LATER + #include <emmintrin.h> +#endif + NAMESPACE_BEGIN(CryptoPP) #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || (_MSC_VER >= 1400 && CRYPTOPP_BOOL_X64) @@ -10,12 +14,15 @@ NAMESPACE_BEGIN(CryptoPP) #define CRYPTOPP_CPUID_AVAILABLE // these should not be used directly -extern bool g_x86DetectionDone; -extern bool g_hasSSE2, g_hasMMX, g_hasSSSE3, g_isP4; -extern int g_cacheLineSize; -void DetectX86Features(); +extern CRYPTOPP_DLL bool g_x86DetectionDone; +extern CRYPTOPP_DLL bool g_hasSSE2; +extern CRYPTOPP_DLL bool g_hasMMX; +extern CRYPTOPP_DLL bool g_hasSSSE3; +extern CRYPTOPP_DLL bool g_isP4; +extern CRYPTOPP_DLL word32 g_cacheLineSize; +CRYPTOPP_DLL void DetectX86Features(); -bool CpuId(word32 input, word32 *output); +CRYPTOPP_DLL bool CpuId(word32 input, word32 *output); #if CRYPTOPP_BOOL_X64 inline bool HasSSE2() {return true;} @@ -94,6 +101,7 @@ inline bool HasMMX() {return false;} #define ASL(x) GNU_ASL(x) #define ASJ(x, y, z) GNU_ASJ(x, y, z) #define ASC(x, y) #x " " #y ";" + #define CRYPTOPP_NAKED #else #define AS1(x) __asm {x} #define AS2(x, y) __asm {x, y} @@ -102,11 +110,26 @@ inline bool HasMMX() {return false;} #define ASL(x) __asm {label##x:} #define ASJ(x, y, z) __asm {x label##y} #define ASC(x, y) __asm {x label##y} + #define CRYPTOPP_NAKED __declspec(naked) #endif // GNU assembler doesn't seem to have mod operator #define ASM_MOD(x, y) ((x)-((x)/(y))*(y)) +#if CRYPTOPP_BOOL_X86 + #define WORD_SZ 4 + #define WORD_REG(x) e##x + #define WORD_PTR DWORD PTR + #define AS_PUSH(x) AS1(push e##x) + #define AS_POP(x) AS1(pop e##x) +#elif CRYPTOPP_BOOL_X64 + #define WORD_SZ 8 + #define WORD_REG(x) r##x + #define WORD_PTR QWORD PTR + #define AS_PUSH(x) AS1(pushq r##x) + #define AS_POP(x) AS1(popq r##x) +#endif + NAMESPACE_END #endif |