Hi, I recently came across a code which had the below lines.
unsigned int n = 10;
n ^= (unsigned int) - 1 ;
It is not clear to me what the second line does.
Anyone can help please :)
on 03/05/2010 – Made popular on 03/05/2010
when a date type is considered signed and unsigned is that simple referring to - for signed and positive numbers for unsigned? Further if that is the case would mutiplying and dividing ect where 2 signed numbers, like (-2)*(-2) = 4 result in a unsigned.
I need to write the implementation of __sync_fetch_and_sub atomic operation myself in assembly language based on GCC 3.4 which doesn't have __sync_fetch_and_sub builtins. But I know little about assembly.