Fix SunCC 12.2 and 12.3 failed compile in rijndael.cpp due to std::swap(__m128i, __m128i)
parent
3c96be47d2
commit
1cb906938d
|
|
@ -274,8 +274,15 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, c
|
||||||
rk = m_key;
|
rk = m_key;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
|
#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5120)
|
||||||
|
// __m128i is an unsigned long long[2], and support for swapping it was not formally added until C++11.
|
||||||
|
// SunCC 12.1 - 12.3 fail to consume the swap; while SunCC 12.4 consumes it without -std=c++11.
|
||||||
|
__m128i t = *(__m128i *)(rk);
|
||||||
|
*(__m128i *)(rk) = *(__m128i *)(rk+4*m_rounds);
|
||||||
|
*(__m128i *)(rk+4*m_rounds) = t;
|
||||||
|
#else
|
||||||
std::swap(*(__m128i *)(void *)(rk), *(__m128i *)(void *)(rk+4*m_rounds));
|
std::swap(*(__m128i *)(void *)(rk), *(__m128i *)(void *)(rk+4*m_rounds));
|
||||||
|
#endif
|
||||||
for (i = 4, j = 4*m_rounds-4; i < j; i += 4, j -= 4)
|
for (i = 4, j = 4*m_rounds-4; i < j; i += 4, j -= 4)
|
||||||
{
|
{
|
||||||
temp = _mm_aesimc_si128(*(__m128i *)(void *)(rk+i));
|
temp = _mm_aesimc_si128(*(__m128i *)(void *)(rk+i));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue