Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Signed shaping to unsigned shaping
Signed shaping to unsigned shaping
When a is defined as int, it will always be int. Please look at the following code:

int a =-5;

A = (unsigned) a;

According to the code, we guess that A is converted to unsigned first, but because A itself is an int type, it will implicitly perform another conversion from unsigned to int, and the conclusion is that the value of A will not change. In fact, let's take a look at the so-called type conversion: (the following eax is equivalent to a temporary variable):

int a =-5;

Mov dword ptr [a], 0FFFFFFFBh assigns -5 to a.

A = (unsigned) a;

mov eax,dword ptr[a]; Value assigned to eax

Mov dword ptr [a], Eax value assigned to eax.

Judging from the above guess, a = (unsigned) A will perform two operations, and it does correspond to two instructions. However, the so-called "A turns to unsigned first" means to make an assignment that doesn't change anything, and the so-called "implicit conversion from unsigned to int" means to make an assignment that doesn't change anything (the above statement is limited to the case where the two types are the same size). So your code can't achieve your goal at all.