mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Use #pragma omp simd for OpenMP 3.0 compilers (GH #787)
This commit is contained in:
parent
3f38a5f7dd
commit
8572541841
@ -90,11 +90,12 @@ void Salsa20_Core(word32* data, unsigned int rounds)
|
|||||||
x[15] ^= rotlConstant<18>(x[14]+x[13]);
|
x[15] ^= rotlConstant<18>(x[14]+x[13]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
// OpenMP 3.0 released May 2008.
|
||||||
|
#if _OPENMP >= 200805
|
||||||
|
#pragma omp simd
|
||||||
for (size_t i = 0; i < 16; ++i)
|
for (size_t i = 0; i < 16; ++i)
|
||||||
data[i] += x[i];
|
data[i] += x[i];
|
||||||
#else
|
#else
|
||||||
#pragma omp simd
|
|
||||||
for (size_t i = 0; i < 16; ++i)
|
for (size_t i = 0; i < 16; ++i)
|
||||||
data[i] += x[i];
|
data[i] += x[i];
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,11 +64,12 @@ static inline void BlockCopy(byte* dest, byte* src, size_t len)
|
|||||||
|
|
||||||
static inline void BlockXOR(byte* dest, byte* src, size_t len)
|
static inline void BlockXOR(byte* dest, byte* src, size_t len)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
// OpenMP 3.0 released May 2008.
|
||||||
|
#if _OPENMP >= 200805
|
||||||
|
#pragma omp simd
|
||||||
for (size_t i = 0; i < len; ++i)
|
for (size_t i = 0; i < len; ++i)
|
||||||
dest[i] ^= src[i];
|
dest[i] ^= src[i];
|
||||||
#else
|
#else
|
||||||
#pragma omp simd
|
|
||||||
for (size_t i = 0; i < len; ++i)
|
for (size_t i = 0; i < len; ++i)
|
||||||
dest[i] ^= src[i];
|
dest[i] ^= src[i];
|
||||||
#endif
|
#endif
|
||||||
|
3
test.cpp
3
test.cpp
@ -547,7 +547,8 @@ void PrintSeedAndThreads()
|
|||||||
tc = omp_get_num_threads();
|
tc = omp_get_num_threads();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Using " << tc << " OMP " << (tc == 1 ? "thread" : "threads") << std::endl;
|
std::cout << "OpenMP version " << (int)_OPENMP << ", ";
|
||||||
|
std::cout << tc << (tc == 1 ? " thread" : "threads") << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user