T
T
Given:
typedef unsigned short u16;
typedef signed int i32;
u16 u0 = 0xFFFF;
i32 i1 = u0;
u16 u1 = 0;
i32 i2 = u1 - (u16)1;
printf("p1: %d, %d \n", i1, i2 );
-------------------------------------------------------
Why do i1 & i2 have different results?
Isn't the rhs of i2 supposed to be done entirely in u16?
or put another way, why isn't the above i2 computed like this
i2 = u16( u1 - (u16)1)
typedef unsigned short u16;
typedef signed int i32;
u16 u0 = 0xFFFF;
i32 i1 = u0;
u16 u1 = 0;
i32 i2 = u1 - (u16)1;
printf("p1: %d, %d \n", i1, i2 );
-------------------------------------------------------
Why do i1 & i2 have different results?
Isn't the rhs of i2 supposed to be done entirely in u16?
or put another way, why isn't the above i2 computed like this
i2 = u16( u1 - (u16)1)