Staticvoid teacore (unsignedint in[2], unsignedint out[2], unsignedint key[4], long rounds)
{
unsigned int y = in[0], z = in[1];
unsigned int limit = 0, sum = 0;
if (Rounds > 0) //Encrypt
{
Limit = DELTA * rounds;
while (Sum! = limit)
{
Y + = ((z<<4) ^ (z>>5)) + (z^sum) + key[sum&3];
Sum + = DELTA;
z + = ((y<<4) ^ (y>>5)) + (y^sum) + key[(sum>> one) &3];
}
}
else//Decrypt
{
sum = DELTA * (-rounds);
while (sum)
{
Z-= ((y<<4) ^ (y>>5) + (y^sum) + key[(sum>>one) &3];
Sum-= DELTA;
Y-= ((z<<4) ^ (z>>5) + (z^sum) + key[sum&3];
}
}
//arm Memory 4- byte alignment
Out[0] = y; OUT[1] = Z;
memcpy (void*) &out[0], (void*) &y, sizeof(unsigned int));
memcpy (void*) &out[1], (void*) &z, sizeof(unsigned int ));
}
The iOS platform requires memory byte alignment when forcing data type conversions. And the debug environment is not required. If the two coercion type conversion is separated by the OC code, release execution is also correct, so again it is suspected that the compiler optimization is the result of XOCDE at compile time.