Code: Select all
unsigned int m_font_timer = 0;
int Getsum(int p_top_left_x)
{
int l_sum = (((p_top_left_x + (m_font_timer >> 2)) & 0x7) - 4 ) >> 2;
if (l_sum < 0) l_sum = -l_sum;
return l_sum;
}
Code: Select all
= ((p_top_left_x + (m_font_timer >> 2)) & 0x7) - 4 );
I wasn't expecting that part to turn into unsigned. I have this code running on two other platforms also with GCC (higher version than the one I'm using for DC, currently 4.7.3) and one with MSCV and they all keep the aforementioned expression as signed.
I don't know much about compilers, is this undefined behavior?
Is there any way the compiler would warn me about this? I have -Wall -Wformat=0 -Wextra -Wsign-compare but doesn't rise any warnings in that function.
Thanks!