Hi Everyone,
Integer class took a bug report under Sun Studio 12.4. Also see Issue 184:
Error: The operand "___LKDB" cannot be assigned to (http://github.com/weidai11/cryptopp/issues/188).
Sun CC 12.4 is an important Sun compiler because its their C++11 compiler. I'm fairly certain the bug report is bogus, and its a compiler bug. Never the less, we had to work around it.
The hack is available at
http://github.com/weidai11/cryptopp/commit/7e06c1dce4b0ebc89708ba7afbcc23ff9093f4ea. The essence of the hack is:
#if (__SUNPRO_CC == 0x5130)
# define MAYBE_CONST
#else
# define MAYBE_CONST const
#endif
...
static word LinearMultiply(word *C, const word *AA, word B, size_t N)
{
MAYBE_CONST word* A = const_cast<word*>(AA);
word carry=0;
for(unsigned i=0; i<N; i++)
{
Declare2Words(p);
MultiplyWords(p, A[i], B);
Acc2WordsBy1(p, carry);
C[i] = LowWord(p);
carry = HighWord(p);
}
return carry;
}
Under Sun CC, we cast away the const-ness. Under other compilers, we cast it away but restore it through MAYBE_CONST. For the other compilers, we are just creating a shadow.
I want to ensure there are __**NO**__ performance hits for this one.
If possible, could we get some testing under Visual Studio 2015 and 2016?
Jeff