Undef vector, bool and pixel

pull/507/head
Jeffrey Walton 2017-09-11 22:39:59 -04:00
parent 120b415e27
commit 9c9d5ebe87
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 33 additions and 22 deletions

38
cpu.cpp
View File

@ -572,6 +572,9 @@ void DetectArmFeatures()
# ifndef PPC_FEATURE2_ARCH_2_07
# define PPC_FEATURE2_ARCH_2_07 0x80000000
# endif
# ifndef PPC_FEATURE2_VEC_CRYPTO
# define PPC_FEATURE2_VEC_CRYPTO 0x02000000
# endif
#endif
bool CRYPTOPP_SECTION_INIT g_PowerpcDetectionDone = false;
@ -579,13 +582,11 @@ bool CRYPTOPP_SECTION_INIT g_hasAltivec = false, CRYPTOPP_SECTION_INIT g_hasPowe
bool CRYPTOPP_SECTION_INIT g_hasAES = false, CRYPTOPP_SECTION_INIT g_hasSHA1 = false, CRYPTOPP_SECTION_INIT g_hasSHA2 = false;
word32 CRYPTOPP_SECTION_INIT g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
// Can't use bool return type because early Apple systems,
// like G5's, perform '#define bool __bool' in <altivec.h>.
extern int CPU_ProbeAltivec();
extern int CPU_ProbePower8();
extern int CPU_ProbeAES();
extern int CPU_ProbeSHA1();
extern int CPU_ProbeSHA2();
extern bool CPU_ProbeAltivec();
extern bool CPU_ProbePower8();
extern bool CPU_ProbeAES();
extern bool CPU_ProbeSHA1();
extern bool CPU_ProbeSHA2();
inline bool CPU_QueryAltivec()
{
@ -610,7 +611,7 @@ inline bool CPU_QueryPower7()
inline bool CPU_QueryPower8()
{
// Power8 and ISA 2.07 provide in-core crypto
// Power8 and ISA 2.07 provide in-core crypto.
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
return true;
@ -620,29 +621,38 @@ inline bool CPU_QueryPower8()
inline bool CPU_QueryAES()
{
// Power8 and ISA 2.07 provide in-core crypto
// Power8 and ISA 2.07 provide in-core crypto. Glibc
// 2.24 or higher is required for PPC_FEATURE2_VEC_CRYPTO.
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO)
return true;
//if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
// return true;
#endif
return false;
}
inline bool CPU_QuerySHA1()
{
// Power8 and ISA 2.07 provide in-core crypto
// Power8 and ISA 2.07 provide in-core crypto. Glibc
// 2.24 or higher is required for PPC_FEATURE2_VEC_CRYPTO.
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO)
return true;
//if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
// return true;
#endif
return false;
}
inline bool CPU_QuerySHA2()
{
// Power8 and ISA 2.07 provide in-core crypto
// Power8 and ISA 2.07 provide in-core crypto. Glibc
// 2.24 or higher is required for PPC_FEATURE2_VEC_CRYPTO.
#if defined(__linux__)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO)
return true;
//if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07)
// return true;
#endif
return false;
}

View File

@ -23,10 +23,11 @@
# undef CRYPTOPP_POWER8_CRYPTO_AVAILABLE
#endif
// We can't use bool return type because early Apple systems,
// like G5's, perform '#define bool __bool' in <altivec.h>.
#if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
# include "altivec.h"
# undef vector
# undef pixel
# undef bool
#endif
#if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
@ -63,7 +64,7 @@ extern "C" {
};
#endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY
int CPU_ProbeAltivec()
bool CPU_ProbeAltivec()
{
#if (CRYPTOPP_ALTIVEC_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
@ -113,7 +114,7 @@ int CPU_ProbeAltivec()
}
#if 0
int CPU_ProbePower7()
bool CPU_ProbePower7()
{
#if (CRYPTOPP_POWER7_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
@ -157,7 +158,7 @@ int CPU_ProbePower7()
}
#endif
int CPU_ProbePower8()
bool CPU_ProbePower8()
{
#if (CRYPTOPP_POWER8_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
@ -200,7 +201,7 @@ int CPU_ProbePower8()
#endif // CRYPTOPP_ALTIVEC_AVAILABLE
}
int CPU_ProbeAES()
bool CPU_ProbeAES()
{
#if (CRYPTOPP_POWER8_AES_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
@ -251,7 +252,7 @@ int CPU_ProbeAES()
#endif // CRYPTOPP_ALTIVEC_AVAILABLE
}
int CPU_ProbeSHA1()
bool CPU_ProbeSHA1()
{
#if (CRYPTOPP_ALTIVEC_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)
@ -284,7 +285,7 @@ int CPU_ProbeSHA1()
#endif // CRYPTOPP_ALTIVEC_AVAILABLE
}
int CPU_ProbeSHA2()
bool CPU_ProbeSHA2()
{
#if (CRYPTOPP_ALTIVEC_AVAILABLE)
# if defined(CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY)