Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the conversion from a signed integer -3 to an unsigned integer?
What is the conversion from a signed integer -3 to an unsigned integer?
Adding 1 to this signature plastic is unsigned plastic.

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;