When we declare a variable of int
for example:
int i = 4;
The following IL is generated :
IL_0001: /* 1A | */ ldc.i4.4
I can understand that 1A is the hexadecimal representation of 4, so am i understanding right that hexadecimal value is saved used to refer to value of it or it means something different?
When i declare a double variable like:
double d = 12.34;
Following IL is generated which i am not able to get few things in it:
IL_0003: /* 23 | AE47E17A14AE2840 */ ldc.r8 12.34
How is 23 coming and what it means and what is AE47E17A14AE2840
here?
When i declare a float with same value:
float f = 12.34f;
i have this IL now:
IL_000d: /* 22 | A4704541 */ ldc.r4 12.34
Same question here as well how 22
comes and what it means and what is A4704541
?
I think it is important to understand what ildasm is telling you. The bytes in front of the pipe character are the values of the opcode and the following bytes are the operand or parameter.
I can understand that 1A is the hexadecimal representation of 4, so am I understanding right that hexadecimal value is saved used to refer to value of it or it means something different?
1A
in this case is the value of the ldc.i4.4
opcode. This opcode is a shortcut of a ldc.i4 4
instruction which would result in the absolute same behavior, but would be 5 bytes long, 1 byte opcode and 4 bytes parameter. These shortcuts exists for the int values from -1 to 8 because they are often used and so the size of the method body can be reduced.
Now it should be clear how your floating point instructions are formed. 23
and 22
are the opcodes and the parameter is the IEEE 754
encoded floating point number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With