Since most significant bit stands for sign bit, it can be converted by the following code:
int a;
Unsigned int b;;
If the highest bit of (a & amp0x8000) // is 1, it means negative.
{
b =(~ a+ 1);
}
Else // The highest bit is not 1, which means it is not a negative number.
{
b = a;
}
Return to b;